tags:

views:

28

answers:

1

Since .Net 4 does support generics in XAML, I'd like to create a UserControl using generics, like:

public class MyComboBox<T>
{
}

I can declare the UserControl quite well, but how would I use it in a XAML file?

Or can't this be done in XAML?

A: 

That would be:

<MyComboBox x:TypeArguments="yourtype" />

Note that it's the XAML 2009 format that supports this. But Visual Studio (even 2010) has no support for compiling XAML 2009 to BAML, only for loading loose xaml files. In the current state, unless you want to load all your .xaml files dynamically, you can't use those new features.

Julien Lebosquain
That might explain why this did not work when I tried it.
Sam