I have a button which is defined in XAML like this:
<Button x:Name="CommandsBtn"
HorizontalAlignment="Right"
Style="{StaticResource ControlsAppBarButtonStyle}"
Click="Commands_Click"
FontFamily="Segoe UI Symbol"
Background="{x:Null}"
BorderBrush="{x:Null}"
Margin="0"
Grid.Column="3" />
and the ControlsAppBarButtonStyle is defined like this:
<Style x:Key="ControlsAppBarButtonStyle"
TargetType="ButtonBase"
BasedOn="{StaticResource AppBarButtonStyle}">
<Setter Property="AutomationProperties.AutomationId"
Value="CommandsAppBarButton" />
<Setter Property="AutomationProperties.Name"
Value="Controls" />
<Setter Property="Content"
Value="" />
</Style>
I would like to detect the PointerPressed and PointerReleased events. I do detect the click event.
Tried to do:
CommandsBtn.PointerPressed += CommandsBtn_PointerPressed;
CommandsBtn.PointerReleased += CommandsBtn_PointerReleased;
But the events are not being fired (or at least are not getting to my page).
How do I do that?
Thanks,
EitanB
Bind to the Button’s IsPressed property and handle changes of your bound property to see the changes. Consider using RepeatButton too.