在许多Windows Phone 7应用程序中,默认情况下隐藏了应用程序栏,当您按住屏幕时,应用程序栏会变为可见。由于许多WP7应用程序具有此行为,因此我想知道ApplicationBar是否支持此类行为,并且如何使用它?
在许多Windows Phone 7应用程序中,默认情况下隐藏了应用程序栏,当您按住屏幕时,应用程序栏会变为可见。由于许多WP7应用程序具有此行为,因此我想知道ApplicationBar是否支持此类行为,并且如何使用它?
<TextBlock TextWrapping="Wrap" Text="lorem ipsum ...">
<toolkit:GestureService.GestureListener>
<toolkit:GestureListener Hold="TapAndHold" />
</toolkit:GestureService.GestureListener>
</TextBlock>
并为事件处理程序提供以下内容:
private void TapAndHold(object sender, GestureEventArgs e)
{
this.ApplicationBar.IsVisible = !this.ApplicationBar.IsVisible;
}
按住文本块的任意位置,即可切换应用程序栏的显示。
如果您希望在用户点击并按住页面上的任何位置时切换,则可以将手势监听器附加到页面的根对象。例如:
<Grid x:Name="LayoutRoot" Background="Transparent">
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
<toolkit:GestureService.GestureListener>
<toolkit:GestureListener Hold="TapAndHold" />
</toolkit:GestureService.GestureListener>