wpf - Targetting DataTemplate for only on certain views -


I have a datatapplette inside a global / shared resource tool that targets a datatype:

  & lt; Datamapplet datatype = "{x: type foo: times}" & gt; & Lt ;! - My Datatapple Visual Tree goes here ... - & gt; & Lt; / DataTemplate & gt; This datatyploplet replaces all my fuses: Bar Types (UserControls / Windows) on all my views What do I want to do This template only applies certain ideas, other data. Is not being affected by this datatyhelplet. I can copy this datatapplet to the resources section of each of these scenes, but I would not want to copy / paste the content of the Datamapplet which will result in maintenance headaches.   

What you're using here is called it. And you are asking for a clear one, you can use the clear resource key to complete it:

  DataTemplate x: key = "MyStyle" datatype = "{x: type Foo: times} "& gt; & Lt ;! - My Datatapple Visual Tree goes here ... - & gt; & Lt; / DataTemplate & gt;  

and later in xaml:

  & lt; ContentPresenter ContentTemplate = "{StaticResource MyStyle}" ... />  

Another solution would be a resource dictionary (with the built-in data templates) that is used from within the proper control / page.

I like the first approach, because it is easy to maintain (there are hard ways to detect underlying styles).


Comments

Popular posts from this blog

windows - Heroku throws SQLITE3 Read only exception -

lex - Building a lexical Analyzer in Java -

python - rename keys in a dictionary -