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
4155
How can i apply IG Themes to Microsoft Controls AND apply a style?
posted

How can i apply a style to, for example, a button, when using the new ThemeManager to theme MS WPF controls?  If I apply any style, the IG theme is disregarded?  See the sample app.  It shows a button with an explicit style that just sets its width and height.  But when i apply it to my button, the button no longer takes the properties from the ThemeManager.  I tried BasedOn, it didn't help.  Also, Implicit styling of a button seems to be ignored (commented out in my sample as to show No Style).  Is there a way to accomplish styling the button based of the IG Theme?

WpfApplication20.zip
Parents
No Data
Reply
  • 34510
    Offline posted

    Hi Travis,

    Your BasedOn style actually does work but because of the order in which things are added to the Application.Resources, the ThemeManager resource dictionary is getting priority over the based on Button style.  The first dictionary added to the Application.Resources.MergedDictionaries collection is your explicit styles one.  After which the IG Theme resource dictionary is added.  Since it was added second, it's resources have priority.

    If you move your resource dictionary into the MainWindow.Resources you'll see that your BasedOn style works.  So in order for your custom styles to be used, they need to basically be added after the ThemeManager's resources.

Children