问题
How do I detect if AppBarButton is being held? There is a Holding event, but it never fires, even if I set AppBarButton's property IsHoldingEnabled to true. Or even when I set CommandBar's IsHoldingEnabled to true.
回答1:
Try this code within your xaml
code for your appbar
.
<page.BottomAppBar>
<commandBar>
<commandBar.PrimaryCommands>
<appBarButton Label="formatting"
IsHoldingEnabled="True"
Holding="AppBarButton_Holding">
<appBarButton.Icon>
<pathIcon HorizontalAlignment="Center" VerticalAlignment="Center" Data="Some path"/>
</appBarButton.Icon>
</appBarButton>
</commandBar.PrimaryCommands>
</commandBar>
</page.BottomAppBar>
Reference
Hope it helps!
来源:https://stackoverflow.com/questions/25261742/wp8-1-appbarbutton-holding-event