New XAML features in .NET 4.0 Beta 1
There's a whole new XAML stack in the recently released beta 1 (download here) with a bunch of exciting new features making XAML even more expressive. You can check out Rob's blog and Channel 9 for an overview. I thought I'd discuss some new features for designing new types (Activities, Services, etc) in XAML. Sorry, this isn't supported for WPF as of now.
When you fire up Visual Studio 2010 and create a new WCF or WF project, you'll see there's now a XAML file that defines your workflow or service.
For WCF, the service is actually "loose" XAML. It doesn't create a new type and will simply be instantiated by your service host with the equivalent of XamlServices.Load.
For WF, the workflow is defined as a new type that will be compiled as part of your project, if you look at the XAML in the new project there'll be something like this:
<
p:Activity x:Class="WorkflowConsoleApplication1.Sequence1" ...
Nothing new here except x:Class is applied to a WF type instead of WPF. Now lets add some arguments to the Activity:
<
p:Activity x:Class="WorkflowConsoleApplication1.Sequence1" ...>
<
x:Members>
<
x:Property Name="Input" Type="p:InArgument(x:String)" />
<
x:Property Name="Output" Type="p:OutArgument(x:String)" />
<
x:Property Name="Temp" Type="x:String" />
...
Here's where we see some of the new XAML features. x:Members defines a collection of new members to add to this type. x:Property adds a property. Name and type are specified here, visibility (public, protected, etc) can be specified with the Modifer property. We can also see the new generics support as p:InArgument(x:String) refers to the type InArgument<string>. All of the new language features mentioned in Rob's post can be used in this XAML.