WPF: How to dynamically find a usercontrol or datatemplate
Posted
by Elger
on Stack Overflow
See other posts from Stack Overflow
or by Elger
Published on 2010-05-18T19:45:09Z
Indexed on
2010/05/18
19:50 UTC
Read the original article
Hit count: 467
I have a bunch of datatemplates I use to display various sql-views in an ItemsControl. I don't know which datatemplate i'm going to use until run-time. (every view has different columns) Next to that, I made a generic dynamic datatemplate for all those views that don't need anything special.
When I display the view I want to first look in all the available datatemplates if there is one that matches, else use the default dynamic datatemplate.
My question is how can I 'search' a datatemplate by name in code? Usercontrol is also possible.
Thanks,
Elger
© Stack Overflow or respective owner