Cartesius00
Cartesius00

Reputation: 24414

Generics in XAML

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>.

Upvotes: 5

Views: 944

Answers (2)

AQL.exe
AQL.exe

Reputation: 276

May be use DataTemplateSelector.

Upvotes: 1

aL3891
aL3891

Reputation: 6275

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 :)

Upvotes: 0

Related Questions