Can't get the new 2009 XAML primitives working, why?
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?
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.
Use
xmlns:clr="clr-namespace:System;assembly=mscorlib"
to import clr namespaces.
Then use for example clr:String
to reference a specific type.
精彩评论