Hi,
in my app I'm using the sfSwitch button from an example of yours. This is the XAML code.
<buttons:SfSwitch
Grid.Column="2"
Margin="8,0"
AllowIndeterminateState="False"
HeightRequest="28"
VisualType="Cupertino"
IsOn="{Binding ApplyTaxes}"
>
<!-- -->
<VisualStateManager.VisualStateGroups>
<VisualStateGroup x:Name="CommonStates">
<VisualState x:Name="On">
<VisualState.Setters>
<Setter Property="SwitchSettings">
<Setter.Value>
<buttons:CupertinoSwitchSettings
x:TypeArguments="buttons:OnState"
ThumbBorderColor="{DynamicResource Gray-200}"
ThumbColor="{DynamicResource Gray-White}"
TrackBorderColor="{DynamicResource Gray-200}"
TrackColor="{DynamicResource PrimaryColor}" />
</Setter.Value>
</Setter>
</VisualState.Setters>
</VisualState>
<VisualState x:Name="Off">
<VisualState.Setters>
<Setter Property="SwitchSettings">
<Setter.Value>
<buttons:CupertinoSwitchSettings
x:TypeArguments="buttons:OffState"
ThumbBorderColor="{DynamicResource Gray-200}"
ThumbColor="{DynamicResource Gray-White}"
TrackBorderColor="{DynamicResource Gray-200}"
TrackColor="{DynamicResource Gray-200}" />
</Setter.Value>
</Setter>
</VisualState.Setters>
</VisualState>
</VisualStateGroup>
</VisualStateManager.VisualStateGroups>
</buttons:SfSwitch>
My app is using a light and dark theme. The problem is, when I change the theme at runtime (on iOS in my case), the style of the sfSwitch do not change.
However only on the currently open ContentPage. If I visit another page, the style displayed accurately. All other styles are working fine, it's just the sfSwitch control
which has issues. It's also the only control using the VisualStateGroup though.
I also tried to apply the VisualStateGroup in a style, however I saw that this isn't possible with the sfSwitch control.
Please see the screenshots attached.
It seems that the keyword "DynamicResource" seems not to work as aspected.
Attachment:
screenshots_fa447e41.zip