uno: Button does not revert back from a pressed state
Current behavior
When multiple buttons are on screen and the user makes several quick selections, buttons can be stuck in a pressed state. This could be a pointer issue but I do not know for certain.
This behavior appears most often with a GTK build (linux arm64), utilizing touch only, and while under heavy CPU usage. Note that I using software rendering as OpenGLES is not support with my current GPU.
Expected behavior
Button should revert back to the normal (unpressed state).
How to reproduce it (as minimally and precisely as possible)
Using Uno Material Win UI 2.3.0
The following page and styles were used in the provided gif and screen shots below.
Run the page below. Make multiple quick selections to buttons on screen. Eventually one will get stuck on a focused state.
<Page
x:Class="App1.ButtonStateStuckPage"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="using:App1"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
Background="{ThemeResource ApplicationPageBackgroundThemeBrush}"
mc:Ignorable="d">
<Page.Resources>
<Style x:Key="FeedbackButton" TargetType="Button">
<Setter Property="Padding" Value="0" />
<Setter Property="Margin" Value="4" />
<Setter Property="HorizontalContentAlignment" Value="Center" />
<Setter Property="VerticalContentAlignment" Value="Center" />
<Setter Property="HorizontalAlignment" Value="Stretch" />
<Setter Property="VerticalAlignment" Value="Stretch" />
<Setter Property="CornerRadius" Value="10" />
<Setter Property="Template">
<ControlTemplate TargetType="Button">
<!--<Grid x:Name="MainGrid">-->
<ContentPresenter
x:Name="ContentPresenter"
Padding="{TemplateBinding Padding}"
HorizontalAlignment="{TemplateBinding HorizontalAlignment}"
VerticalAlignment="{TemplateBinding VerticalAlignment}"
HorizontalContentAlignment="{TemplateBinding HorizontalContentAlignment}"
VerticalContentAlignment="{TemplateBinding VerticalContentAlignment}"
Background="{TemplateBinding Background}"
BorderBrush="{TemplateBinding BorderBrush}"
BorderThickness="{TemplateBinding BorderThickness}"
Content="{TemplateBinding Content}"
ContentTemplate="{TemplateBinding ContentTemplate}"
CornerRadius="{TemplateBinding CornerRadius}" />
<!--</Grid>-->
<!--<VisualStateManager.VisualStateGroups>
<VisualStateGroup x:Name="CommonStates">
<VisualState x:Name="Normal">
<Storyboard>
<PointerUpThemeAnimation Storyboard.TargetName="MainGrid" />
</Storyboard>
</VisualState>
<VisualState x:Name="Pressed">
<Storyboard>
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="MainGrid" Storyboard.TargetProperty="Background">
<DiscreteObjectKeyFrame KeyTime="0" Value="White" />
</ObjectAnimationUsingKeyFrames>
<PointerDownThemeAnimation Storyboard.TargetName="MainGrid" />
</Storyboard>
</VisualState>
</VisualStateGroup>
</VisualStateManager.VisualStateGroups>-->
<VisualStateManager.VisualStateGroups>
<VisualStateGroup x:Name="CommonStates">
<VisualState x:Name="Normal" />
<VisualState x:Name="Pressed">
<VisualState.Setters>
<Setter Target="ContentPresenter.BorderBrush" Value="White" />
</VisualState.Setters>
</VisualState>
<VisualState x:Name="PointerOver">
<VisualState.Setters />
</VisualState>
</VisualStateGroup>
<VisualStateGroup x:Name="FocusStates">
<VisualState x:Name="Focused" />
<VisualState x:Name="PointerFocused" />
<VisualState x:Name="Unfocused" />
</VisualStateGroup>
</VisualStateManager.VisualStateGroups>
</ControlTemplate>
</Setter>
</Style>
</Page.Resources>
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="100" />
<ColumnDefinition Width="100" />
<ColumnDefinition Width="100" />
<ColumnDefinition Width="100" />
<ColumnDefinition Width="100" />
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="100" />
<RowDefinition Height="100" />
<RowDefinition Height="100" />
<RowDefinition Height="100" />
<RowDefinition Height="100" />
</Grid.RowDefinitions>
<Button Style="{StaticResource FeedbackButton}">
<TextBlock Text="1" />
</Button>
<Button Grid.Column="1" Style="{StaticResource FeedbackButton}">
<TextBlock Text="2" />
</Button>
<Button Grid.Column="2" Style="{StaticResource FeedbackButton}">
<TextBlock Text="3" />
</Button>
<Button Grid.Column="3" Style="{StaticResource FeedbackButton}">
<TextBlock Text="4" />
</Button>
<Button Grid.Column="4" Style="{StaticResource FeedbackButton}">
<TextBlock Text="5" />
</Button>
<Button Grid.Row="1" Style="{StaticResource FeedbackButton}">
<TextBlock Text="5" />
</Button>
<Button Grid.Row="1" Grid.Column="1" Style="{StaticResource FeedbackButton}">
<TextBlock Text="6" />
</Button>
<Button Grid.Row="1" Grid.Column="2" Style="{StaticResource FeedbackButton}">
<TextBlock Text="7" />
</Button>
<Button Grid.Row="1" Grid.Column="3" Style="{StaticResource FeedbackButton}">
<TextBlock Text="8" />
</Button>
<Button Grid.Row="1" Grid.Column="4" Style="{StaticResource FeedbackButton}">
<TextBlock Text="9" />
</Button>
</Grid>
</Page>
Environment
Windows Linux GTK
Nuget Package: Uno Material Win UI
Package Version(s): 2.3.0
Affected platform(s):
- iOS
- Android
- WebAssembly
- WebAssembly renders for Xamarin.Forms
- Windows
- Linux
- Build tasks
Visual Studio:
- 2017 (version: )
- 2019 (version: )
- for Mac (version: )
Relevant plugins:
- Resharper (version: )
Anything else we need to know?

About this issue
- Original URL
- State: closed
- Created 4 years ago
- Comments: 30 (13 by maintainers)
I’ll see if I can compile the source but it may be some time before I can get to it. I will definitely update to the latest once you have merged #11771
I haven’t seen this happen with the latest release. I’m good with closing this. Thanks for your assistance.
You can use 4.9.0-dev.834, or any later build.