Dynamic in xaml Data Template selector

Bryan picture Bryan · May 22, 2013 · Viewed 15.1k times · Source

Ok I found this wonderful idea on code project. link

The idea is great add all your data templates to collection in your list box. Tell each one what to look for (a type) and what data template to use when it runs into that type. The problem is that the included source code is different from the on page code and I can't seen to get any combination of it to work. Even adding the missing quotation marks and changing the type to a local class instead of the non-accessible string and int32 classes.

So the question is. What am I doing wrong?

Bryan

Answer

H.B. picture H.B. · May 22, 2013

Should be totally redundant when you have DataTemplate.DataType.

(Example)