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
360
How to extend Themed styles?
posted

Hello,

my ultimate goal is it to have my validation errors show up as a tooltip on every control while using at least one theme.

To achieve this i tried countless things. I think i am close to what i want, but i cannot figure out the correct style to base my styles on.

What i want to do / am doing with some success on some controls

<Style TargetType="ig:XamComboEditor" BasedOn="???">
    <Setter Property="ToolTip" Value="maayyyybe"/>
</Style>

This is a simplified example obviously. But essentially i just want to add a tooltip to random igControls. I just cannot figure out what to base my style on. BasedOn="{StaticResource {x:Type ig:XamComboEditor}}" does not work. The theme doesnt get applied anymore.

I even tried setting the theme explicitly in the style, but it had no effect. And once i know the right style to base my style on, how do i account for multiple themes?

I really thought the x:Type approach would work, but its inconsistent and random. Some controls work, some dont, controls that do work in the real project dont work in a sample project etc.

I'd also like to avoid putting the entire style dictionaries for each theme in my project if possible. If not, how do i do that? The documentation really is no help.

  • 1500
    Offline posted

    Hello Martin,

    When modifying controls using themes, you must base them on the themed control.

    BasedOn="{x:Static igThemes:GroupName+ThemeName.TargetElement}"

    for XamComboEditor should look like this(using MetroDark theme):

    <Style TargetType="{x:Type igWPF:XamComboEditor}" BasedOn="{x:Static igThemes:EditorsMetroDark.XamComboEditor}">
    <Setter Property="ToolTip" Value="maayyybe"/>
    </Style>

    Please let me know if you have further questions.

    Sincerely,

    Tihomir Tonev
    Associate Software Developer
    Infragistics