开发者

Generic usercontrol possible?

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

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜