Won't Fix
Last Updated: 02 Mar 2023 10:10 by ADMIN
Hanoch
Created on: 31 Jan 2023 17:09
Category: Button
Type: Bug Report
0
Button: [WinUI] BackgroundColor is not updated when DynamicResource is used and button enabling state is changed

BackgroundColor is not applied property when DynamicResource is used and button enabling state is changed

<Style TargetType="telerik:RadButton" x:Key="MyTelerikButtonStyle">
            <Setter Property="TextColor" Value="{DynamicResource MyPrimaryColor}" />
            <Setter Property="BackgroundColor" Value="{DynamicResource MySecondaryColor}" />
            <Style.Triggers>
                <Trigger TargetType="telerik:RadButton" Property="IsEnabled" Value="false" >
                    <Setter Property="BackgroundColor" Value="Gray" />
                </Trigger>
            </Style.Triggers>
</Style>

WORKAROUND:

Use StaticResource:

 <Setter Property="TextColor" Value="White" />
 <Setter Property="BackgroundColor" Value="Green" />

1 comment
ADMIN
Dilyan Traykov
Posted on: 27 Feb 2023 14:49

Hello,

We were actually able to reproduce this issue with the MS Button element. The reason why the top-right Stop Timer button in the attached image has a background is an implicit style targeting the Button element in the used project. If this style is removed, the observed result is identical to this of the Telerik RadButton element.

With this said, we have logged a new issue in the dotnet/maui repository regarding this: Setter using DynamicResource is not reapplied when related trigger condition is updated.

You can follow the issue to get notified about any updates in its status. In the meantime, you can use the proposed workaround of using a StaticResource or explicitly defined color instead.

Regards,
Dilyan Traykov
Progress Telerik

Virtual Classroom, the free self-paced technical training that gets you up to speed with Telerik and Kendo UI products quickly just got a fresh new look + new and improved content including a brand new Blazor course! Check it out at https://learn.telerik.com/.