Targetting DataTemplate for only on certain views
- by huseyint
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.