Targetting DataTemplate for only on certain views
Posted
by huseyint
on Stack Overflow
See other posts from Stack Overflow
or by huseyint
Published on 2010-06-14T14:30:08Z
Indexed on
2010/06/14
14:32 UTC
Read the original article
Hit count: 424
wpf
|datatemplate
I have a DataTemplate inside a global/shared ResourceDictionary like this which targets a DataType:
<DataTemplate DataType="{x:Type foo:Bar}">
<!-- My DataTemplate visual tree goes here... -->
</DataTemplate>
This DataTemplate replaces my all foo:Bar types on all my Views (UserControls/Windows). What I want to do is to apply this template to only certain views, keeping the other views are not affected by this DataTemplate. I can copy this DataTemplate to Resources sections of each of these view, but I don't want to copy/paste the contents of the DataTemplate which would result in maintenance headaches.
© Stack Overflow or respective owner