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();