tags:

views:

46

answers:

2

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?

A: 

Use

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

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

codymanix
Sigh. "What I'd like to use: 2009 XAML primitives". Yes, I know how to do this in the old crappy way. Well, I'm in the land of unicorns and magic puppies known as 4.0. Gone is the bad old days of importing mscorlib to access primitive types in xaml. You understand what I asked about now?
Will
I was trying to help you. Why so arrogant?
codymanix
+3  A: 

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.

Robert Rossney
Wow, that's awful. Thanks.
Will