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
40
XamRibbonWindow ThemeManager and Dependency Injection
posted

We have recently implemented DI for our WPF app, and in doing so it appears the theming no longer works. Our main form is a XamRibbonWindow, and we are now instantiating it using injection to satisfy its dependencies. Everything works except the theming. We are using the ThemeManager to set the ApplicationTheme in startup, however no theme is applied when the window is resolved from our IoC container (ninject at the moment). 

Of note, if we decorate the RibbonWindowContentHost with Theme="[current]", the ribbon does get themed, but the rest of its controls do not. More interestingly, if we decorate the XamDataGrid contained witihin, with Theme="[current]", it displays black headers seemingly from another theme. 

Upon inspection of the created XamRibbonWindow, the IsOffice2013 flag is false. Is there something about injecting the views that is causing this behavior? If so, is there an alternative way to get the application wide theming working in this context?

 ThemeManager.ApplicationTheme= new Office2013Theme();

Parents
  • 40
    Offline posted

    I have some more findings to add. It does appear that theming is being picked up to some degree, as I have switched between metrodark and IG themes and can see changes. It appears as if the Office2013 theme in 2020.2 is corrupt. 
    Another interesting finding is that the XamRibbonWindow menu doesn't appear to pick up the theme no matter what from the ThemeManager. Note the 2 attachements. Working in 17.2 with the office2013 theme. Not working in 20.2 with the office 2013 theme

    .

    Not working. Note the menu not showing properly, and no styling applied.

    Any help appreciated.

Reply Children
No Data