【发布时间】:2016-07-29 12:25:56
【问题描述】:
在 GridView 中,我试图在用户右键单击项目时显示上下文菜单。
我试过了:
<GridView.ItemTemplate>
<DataTemplate>
<StackPanel Orientation="Vertical" Width="120" Background="LightBlue">
<StackPanel.ContextFlyout>
<MenuFlyout>
<MenuFlyoutItem Text="Change color" Click="ChangeColorItem_Click" />
</MenuFlyout>
...
但是StackPanel.ContextFlyout 会引发错误。我错过了什么?
更新
错误是:The attachable property 'ContextFlyout' was not found in type 'StackPanel'
ContextFlyout 是 UIElement 的一个属性,StackPanel 是从 UIElement 派生的。
【问题讨论】:
-
哪个错误?你有什么消息吗?请张贴出来。