开发者

Generic usercontrol possible?

开发者 https://www.devze.com 2023-01-01 00:47 出处:网络
Since .Net 4 does support generics in XAML, I\'d like to create a UserControl using generics, like: public class MyComboBox<T>

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

public class MyComboBox<T>
{
}

I ca开发者_开发问答n declare the UserControl quite well, but how would I use it in a XAML file?

Or can't this be done in XAML?


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.

0

精彩评论

暂无评论...
验证码 换一张
取 消