Applying SkinStorage.VisualStyle upsets AttachedBehaviors for my own base styles

I have an application which uses some attached behaviours/properties to set the background of controls when there values change. As soon as I apply the metro visual style to any parent control my attached behaviors no longer seem to work on an child controls. e.g

syncfusion:SkinStorage.VisualStyle="Metro"

The behavior no longer works.

    <Style TargetType="Control" x:Key="ControlBaseStyle">
        <Setter Property="Validation.ErrorTemplate" Value="{StaticResource DefaultErrorTemplate}" />
        <Setter Property="behaviors:ChangeBehavior.IsActive" Value="True" />
        <Style.Triggers>
            <Trigger Property="behaviors:ChangeBehavior.IsChanged" Value="True">
                <Setter Property="Background" Value="{StaticResource IsChangedBackgroundBrush}" />
                <Setter Property="ToolTip" Value="{Binding RelativeSource={RelativeSource Self}, Path=(behaviors:ChangeBehavior.OriginalValue)}" />
            </Trigger>
            <Trigger Property="Validation.HasError" Value="True">
                <Setter Property="Background" Value="{StaticResource HasErrorBackgroundBrush}" />
            </Trigger>
        </Style.Triggers>
    </Style>



    <Style TargetType="TextBox" BasedOn="{StaticResource ControlBaseStyle}"/>


I have attached a demo project demonstrating the problem with 2 tab controls, one is using the Metro theme and doesn't work, the other is not and does work.

Thanks in advance for your help.

Adam


Attachment: SyncFusionBehaviorProblem_f92c0a06.zip

1 Reply

GS Gokul Sainarayanan Syncfusion Team July 20, 2018 01:04 PM UTC

Hi Adam,

Thanks for contacting Syncfusion support.

We have checked your sample, in this we could see that Metro style is not applied to TabControlExt and also we could see that your TextBox style too not updated. This is due to that style get override and the defined style is not applied.

Now we have modified the sample by merging the TabControl's Metro style in App.xaml. Now it get applied and also your defined style applied for TextBox.

You can find the sample in below location

Sample: http://www.syncfusion.com/downloads/support/forum/138802/ze/SyncFusionBehaviorProblem-1291082257

Regards,
Gokul S

Loader.
Up arrow icon