开发者

Generics in XAML

开发者 https://www.devze.com 2023-03-10 07:50 出处:网络
is it possible to write something like this in XAML: <DataTemplate DataType=\"{x:Type vm:EntityListViewModel<T>}\">

is it possible to write something like this in XAML:

<DataTemplate DataType="{x:Type vm:EntityListViewModel<T>}">

BUT

I need to specify generics because the declaration is开发者_高级运维 EntityListViewModel<T>.


May be use DataTemplateSelector.


There are some support for generics in xaml 2009 http://blogs.windowsclient.net/rob_relyea/archive/2009/06/01/xaml-using-generic-types-in-xaml-2009.aspx

But im not sure if that works with datatemplate.

You could however experiment with setting the DataType property from code... i havet tried that though :)

0

精彩评论

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