如何在 devexpress 数据网格中为每个列单元格制作上下文菜单?
xmlns:dxg="http://schemas.devexpress.com/winfx/2008/xaml/grid"
<dxg:GridControl Grid.Row="0"
Height="150"
ItemsSource="{Binding ObjectViewModel.Collection,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}"
SelectedItem="{Binding CurrentRow,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged,TargetNullValue=null}"
>
<dxg:GridControl.Columns>
<dxg:GridColumn Header="Column1"}"
Width="*"
Binding="{Binding col1,Mode=OneWay}">
</dxg:GridColumn>
<dxg:GridColumn Header="Column2"}
AllowEditing="False"
Width="*"
Binding="{Binding col2,Mode=OneWay}">
<!--<dxg:GridColumn.CellStyle>
<Style TargetType="DataGridCell">
<Setter Property="ContextMenu">
<Setter.Value>
<ContextMenu>
<MenuItem Header="Col2!"></MenuItem>
</ContextMenu>
</Setter.Value>
</Setter>
</Style>
</dxg:GridColumn.CellStyle>-->
</dxg:GridColumn>
</dxg:GridControl>
如何为每一列制作 ContextMenu?
例如,当上下文菜单单击第一列(单元格上属于第一列)时:它显示“Column1 菜单”项,当它单击第二列时(单元格上属于第二列)显示“Column2 菜单”项