In Xaml2009, we have built-in support for common CLR types which simplifies authoring. So rather than specifying something like
<s:String xmlns:s="clr-namespace:System;assembly=mscorlib"> Foo </s:String>
We can use the notation <x:String > Foo </s:String>
The list of types supported is below:
One thing to note is wrt WPF this will work only in loose Xaml. This means that these features cannot be used within Cider\Blend. Rob has a post clarifying the absence of tooling support.
Now you get the slight change in title J
[This is part of a series on New WPF\XAML Features]
Dude, WTF... I thought the whole reasoning with using Xml for UI was toolability, and, ironically, the tools are by far the worst part of the WPF experience.
Robert, we understand that this is not ideal. Please read the clarifying post\comments by Rob http://blogs.windowsclient.net/rob_relyea/archive/2009/05/20/yes-xaml2009-isn-t-everywhere-yet.aspx
That's a strange feature...
The only reason using <x:string> works like that is because you declare the namespace in a parent tag. Most xaml files by default will start something like this:
... which is the only reason the unqualified "x:" namespace will work.
If you add the "xmlns:s" declaration to your root element, then your unwieldy example becomes no heavier than the new alternative:
<s:String> Foo </s:String>
And the tools support that just fine, don't they?
I'm not sure what this adds/improves beyond the single missing namespace ref - is there something in the new tags that improves parsing/construction of the objects? Or is this really just changing an "s" to an "x"?
Daniel, the xaml generated by tools like cider and Blend always have the follows namespaces declared by default (and not just the first one)
Sorry Lester, I realise that - I omitted the namespace more for brevity than anything else.
I think my point is still reasonable, though. Is there a significant difference between these two (more complete) examples?
I was just wondering if there are any other benefits beyond a single missing namespace reference.
as mentioned, it is an improvement in the authoring experience.
What would have been a real improvement would be the ability to include multiple namespaces in the default namespace. Or some project-wide mappings so I don't have to junk up every xaml file with the same mappings.
Thats good feedback John. We'll consider it for future releases.