-
-
Notifications
You must be signed in to change notification settings - Fork 17
Description
Describe the bug
The BackgroundColor of the CircleButton does not get applied to the button when the button's still is bound to a derived style.
To Reproduce
I have the following style defined in my Application ResourceDictionary:
<Style x:Key="DashboardCircleButton"
ApplyToDerivedTypes="True"
TargetType="btnCircle:CircleButton">
<Setter Property="TextColor" Value="Black" />
<Setter Property="HeightRequest" Value="70" />
<Setter Property="WidthRequest" Value="70" />
<Setter Property="BorderThickness" Value="3" />
<Setter Property="BorderColor" Value="Black" />
<Setter Property="HorizontalOptions" Value="Center" />
</Style>
<Style x:Key="DashboardCircleButtonOn"
TargetType="btnCircle:CircleButton"
ApplyToDerivedTypes="True"
BasedOn="{StaticResource DashboardCircleButton}">
<Setter Property="BackgroundColor" Value="LightGreen" />
<Setter Property="TextColor" Value="LightGray" />
<Setter Property="Text" Value="On" />
</Style>
<Style x:Key="DashboardCircleButtonOff"
TargetType="btnCircle:CircleButton"
ApplyToDerivedTypes="True"
BasedOn="{StaticResource DashboardCircleButton}">
<Setter Property="BackgroundColor" Value="OrangeRed" />
<Setter Property="TextColor" Value="Black" />
<Setter Property="Text" Value="Off" />
</Style>
In my ViewModel XAML, I have defined a CircleButton like this:
<btnCircle:CircleButton x:Name="GpsButton" Style="{StaticResource DashboardCircleButton}"
HeightRequest="70" WidthRequest="70" />
In my code-behind file I am setting up a binding to the button's style like this (using ReactiveUI):
this.OneWayBind(ViewModel, x => x.IsGpsOn, x => x.GpsButton.Style, BoolToOnOffCircleButtonStyle);
The BoolToOnOffCircleButtonStyle returns either the DashboardCircleButtonOn or DashboardCircleButtonOff style, depending on the value of the property it is bound to.
Every property on the CircleButton is set correctly, except for the BackgroundColor (the button's background is white).
Expected behavior
The button's background should have the color which is defined in the style that is bound to it.
If I change the type of the button (and the targetType of the style accordingly) to a regular button, everything works as expected.
Please complete the following information:
- Which version of the ButtonCircle do you use: 2.0.3
- Which version of Xamarin.Forms do you use: 3.2.0.871581 (ReactiveUI: 9.0.1)
- Which OS are you talking about: Multi-Platform solution testing UWP project