前面介绍了LibraryContainerScatterView控件,今天我介绍的是ElementMenu,ElementMenu是一个简单的控件,ElementMenu提供的是为应用程序关联的节点菜单和分层菜单,这个控件使用有两个重要的属性,它们是Activation Host和Activation Mode,Activation Mode设置的是激活方式,它有两个成员,一个是HostInteraction,另一个是AlwaysActive。HostInteraction与Activation Host有着密切的联系,只有当Activation Host设置的要激活控件被触碰后,ElementMenu才被激活。而AlwaysActive模式使ElementMenu总是处于激活状态。

下面看一个简单的例子:

Xaml Code:

<s:SurfaceWindow x:Class="ElementMenu.SurfaceWindow1"
xmlns
="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x
="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:s
="http://schemas.microsoft.com/surface/2008"
Title
="ElementMenu"
>
<Grid>
<!-- TouchLabel is the host for the ElementMenu named: MainMenu. -->
<Label Name="TouchLabel"
Content
="触摸这里激活菜单"
HorizontalAlignment
="Center" VerticalAlignment="Bottom"/>
<s:ElementMenu
Name="MainMenu"
ActivationMode
="HostInteraction"
ActivationHost
="{Binding ElementName=TouchLabel}">
<s:ElementMenuItem Header="Menu 1"/>
<s:ElementMenuItem Header="Menu 2"/>
<s:ElementMenuItem Header="Menu 3"/>
<s:ElementMenuItem Header="Menu 4"/>
</s:ElementMenu>
</Grid>
</s:SurfaceWindow>

效果图:

Microsoft Surface控件之ElementMenu

Microsoft Surface控件之ElementMenu

更多内容访问:http://flute.vacau.com/

转载时须注明本文的详细链接,否则作者将保留追究其法律责任。

相关文章:

  • 2021-10-19
  • 2022-12-23
  • 2021-10-29
  • 2021-09-07
  • 2021-08-24
  • 2021-11-06
  • 2021-10-26
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2021-09-20
  • 2022-02-18
  • 2022-12-23
相关资源
相似解决方案