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
1590
How to style native WPF controls in combination with Infragistics theming
posted

Hi, In our application we are using various native WPF controls that are partly styled. For example, a color image is used for a button, and a gray image is shown when the button is disabled. However, the button background should always be according to the current Infragistics theme (this is what I mean with "partly" styled; partly our own style, partly IG). In order to set the image, a WPF Style is used. However, when changing the Infragistics theme, the IG part of the style is ignored for the image button. If you look at my sample, you will see what I mean. The buttons on the right are initially styled correctly, but they do not follow theme changes. How can I achieve this?

Thanks, Stefan

TestThemingNativeWPFControls.zip
Parents
  • 34430
    Verified Answer
    Offline posted

    Hello Stefan,

    Thank you for your post!

    I believe the behavior you are seeing with the Style is expected. The reason for this is because you are defining your own Style for button which is based on a Button style. At the start of your application, it appears that the IGTheme theme is applied, and so that style for your button assumes the style specifications for the IGTheme for whichever properties are not set in your new style. This style then remains static, and will not change when changing the overall theme of the application.

    I would recommend that instead of styling the button, you add Content directly to your buttons in your XAML, and style that content instead. This will allow you to have the theme changes effect the button, while still applying your content changes within the button.

    I have attached a modified version of the sample you sent to demonstrate.

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

    Sincerely,
    Andrew
    Associate Developer
    Infragistics Inc.
    www.infragistics.com/support

    TestThemingNativeWPFControls.zip
Reply Children
No Data