Can't get the new 2009 XAML primitives working, why?

一曲冷凌霜 提交于 2019-12-18 03:34:31

问题


What I'd like to use: 2009 XAML primitives

How it would be nice to use them:

<sapv:ExpressionTextBox xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        ExpressionType="x:String"  />

What actually happens:

"Type reference cannot find the public type named String"

The examples I see don't have updated namespaces. I tried 2009 and 2010, but to no avail. This is in VS 2010 RTM. What am I doing wrong?


回答1:


I believe the key sentence on the documentation page is this:

In WPF, you can use XAML 2009 features but only for XAML that is not markup-compiled. Markup-compiled XAML for WPF and the BAML form of XAML do not currently support the XAML 2009 keywords and features.

So, if you're writing loose XAML that's loaded at runtime via a XamlReader, you can use these primitives. If you're writing XAML that's compiled, you can't.




回答2:


Use

xmlns:clr="clr-namespace:System;assembly=mscorlib" 

to import clr namespaces. Then use for example clr:String to reference a specific type.



来源:https://stackoverflow.com/questions/2653638/cant-get-the-new-2009-xaml-primitives-working-why

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!