-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Button Pressed VisualState not Reverting #8309
Copy link
Copy link
Closed
Labels
area-controls-buttonButton, ImageButtonButton, ImageButtonplatform/windowss/triagedIssue has been reviewedIssue has been revieweds/verifiedVerified / Reproducible Issue ready for Engineering TriageVerified / Reproducible Issue ready for Engineering Triaget/bugSomething isn't workingSomething isn't working
Description
Description
As I understand the documentation of the Button VisualState behaviour here , the Pressed state should be entered when a button is pressed, and then left once the button is no longer pressed.
I have modified the standard maui starter project so that the button goes red if pressed. This does happen, but the button does not revert back to the regular colour once the mouse is released.
Steps to Reproduce
- Create a new Maui app
- Under Styles.xaml replace the Button style (starting line 26) with the following:
<Style TargetType="Button">
<Setter Property="TextColor" Value="{AppThemeBinding Light={StaticResource White}, Dark={StaticResource Primary}}" />
<Setter Property="BackgroundColor" Value="{AppThemeBinding Light={StaticResource Primary}, Dark={StaticResource White}}" />
<Setter Property="FontFamily" Value="OpenSansRegular"/>
<Setter Property="FontSize" Value="14"/>
<Setter Property="CornerRadius" Value="8"/>
<Setter Property="Padding" Value="14,10"/>
<Setter Property="VisualStateManager.VisualStateGroups">
<VisualStateGroupList>
<VisualStateGroup x:Name="CommonStates">
<VisualState x:Name="Normal">
<VisualState.Setters>
<Setter Property="BackgroundColor" Value="{AppThemeBinding Light={StaticResource Primary}, Dark={StaticResource White}}" />
</VisualState.Setters>
</VisualState>
<VisualState x:Name="Pressed">
<VisualState.Setters>
<Setter Property="BackgroundColor" Value="Red" />
</VisualState.Setters>
</VisualState>
<VisualState x:Name="Disabled">
<VisualState.Setters>
<Setter Property="TextColor" Value="{AppThemeBinding Light={StaticResource Gray950}, Dark={StaticResource Gray200}}" />
<Setter Property="BackgroundColor" Value="{AppThemeBinding Light={StaticResource Gray200}, Dark={StaticResource Gray600}}" />
</VisualState.Setters>
</VisualState>
</VisualStateGroup>
</VisualStateGroupList>
</Setter>
</Style>The button will now turn red when pressed, but will not revert when no longer pressed.
It works as expected on android.
Version with bug
6.0.400 (current)
Last version that worked well
Unknown/Other
Affected platforms
Windows
Affected platform versions
Windows 10 19044.1766
Did you find any workaround?
Nope
Relevant log output
No response
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
area-controls-buttonButton, ImageButtonButton, ImageButtonplatform/windowss/triagedIssue has been reviewedIssue has been revieweds/verifiedVerified / Reproducible Issue ready for Engineering TriageVerified / Reproducible Issue ready for Engineering Triaget/bugSomething isn't workingSomething isn't working