Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
1150
Replace DocumentTabItem control template for themes using generic only
posted

Hello,

the DocumentTabItem with DocumentContentHost of XamDockManager uses the default generic template for most themes.
I want to modify this generic template, but keep all templates from themes with other template definitions for this control.

When I define an own template for igDock:PaneTabItem.DocumentTabItemTemplateKey this is used until I define a Theme="xyz" on the control.

What I want:
 - use my modified template when current Theme is "", "generic", "IGTheme", "Office2010" or any other theme using the generic template.
 - use the template from the Theme for Themes defining an own template like "Office2013" or "Metro"

I do not want to create a custom theme. Just override the template for this control on all themes using the generic template.

How can I get this?
Many thanks and best regards!

Parents
  • 34430
    Verified Answer
    Offline posted

    Hello Josef,

    I have been investigating into the behavior you are looking to achieve in this case, and I have a couple of recommendations for you in this case, but both are likely going to be a bit of work as this is not really “easily” achievable due to the way that styling and templating work in WPF, as our “themes” are essentially just a set of styles and templates.

    My first recommendation in this case is to place your template(s) within its own ResourceDictionary. When you use the “generic”, “IGTheme”, “Office2010” or any other theme using the generic template for your XamDockManager, you will need to programmatically merge the ResourceDictionary mentioned above with your XamDockManager.Resources collection. As long as you do this, it should override the default template as it will be merged “more locally” than the theme. You can read about dynamically merging ResourceDictionaries here: https://stackoverflow.com/questions/66422761/how-can-i-merge-two-resourcedictionary-objects-into-application-current-resource.

    Where this could become more complex is that you would need to un-merge that ResourceDictionary any time you change your theme to one that you don’t want to use your templates.

    The alternative option in this case would be to include the relevant XAML theme-files into your application and merge them rather than using the actual Theme property. This may not be a *better* option in this case though, as you would need to ensure that you replace the theme files with the more recent ones whenever you upgrade the Infragistics assemblies or NuGet packages.

    Please let me know if you have any other questions or concerns on this matter.

Reply Children
No Data