Skip to content

Commit 16760d3

Browse files
authored
Add empty PointerOver states to Buttons to reduce confusion (#11842)
We've had multiple users run into issues with the Pressed VisualState on Buttons (see #9715 and #8309) - they set up a Pressed state, and then are confused when the state remains after releasing the Button. This is happening* because the Button is moving into the PointerOver state, which does not exist in their VisualState lists. Since the target state is not found, the Pressed state remains in effect until the user leaves the PointerOver state. This is similar to the behavior of a Pressed state with no PointerOver state defined in UWP/WinUI. The solution is to define a PointerOver state. To reduce confusion, we should just add a PointerOver state to our default templates. * At the time these bugs were originally opened, the problem was likely the Focused state, because PointerOver didn't exist yet. But in the most recent release, PointerOver replaces Focused as the source of the problem; the Focused issue is dealt with by #11840.
1 parent 1f1ea8b commit 16760d3

1 file changed

Lines changed: 2 additions & 0 deletions

File tree

  • src/Templates/src/templates/maui-mobile/Resources/Styles

src/Templates/src/templates/maui-mobile/Resources/Styles/Styles.xaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@
4242
<Setter Property="BackgroundColor" Value="{AppThemeBinding Light={StaticResource Gray200}, Dark={StaticResource Gray600}}" />
4343
</VisualState.Setters>
4444
</VisualState>
45+
<VisualState x:Name="PointerOver" />
4546
</VisualStateGroup>
4647
</VisualStateGroupList>
4748
</Setter>
@@ -152,6 +153,7 @@
152153
<Setter Property="Opacity" Value="0.5" />
153154
</VisualState.Setters>
154155
</VisualState>
156+
<VisualState x:Name="PointerOver" />
155157
</VisualStateGroup>
156158
</VisualStateGroupList>
157159
</Setter>

0 commit comments

Comments
 (0)