有谁知道是否有可能让Contextmenu中的网格工作?我基本上想要在3x3网格中布局菜单项,但是当我可以进入XAML时,网格被忽略。
的Ta,
罗布
答案 0 :(得分:1)
您可以Grid
为Context Menu
添加ItemTemplete
,如下所示
Context Menu
答案 1 :(得分:0)
ContextMenu中的3x3网格
<ContextMenu>
<ContextMenu.Template>
<ControlTemplate>
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition />
<ColumnDefinition />
<ColumnDefinition />
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition />
<RowDefinition />
<RowDefinition />
</Grid.RowDefinitions>
<MenuItem Grid.Row="0" Grid.Column="0" Header="1111" />
<MenuItem Grid.Row="0" Grid.Column="1" Header="2222" />
<MenuItem Grid.Row="0" Grid.Column="2" Header="3333" />
<MenuItem Grid.Row="1" Grid.Column="0" Header="1111" />
<MenuItem Grid.Row="1" Grid.Column="1" Header="2222" />
<MenuItem Grid.Row="1" Grid.Column="2" Header="3333" />
<MenuItem Grid.Row="2" Grid.Column="0" Header="1111" />
<MenuItem Grid.Row="2" Grid.Column="1" Header="2222" />
<MenuItem Grid.Row="2" Grid.Column="2" Header="3333" />
</Grid>
</ControlTemplate>
</ContextMenu.Template>
</ContextMenu>