请帮我
当IM使用行数据网格的上下文菜单时,背景更改为不同的颜色。如何修复它?standart backgroundbackground when using context menu
<DataGrid x:Name="dataGrid" AutoGenerateColumns="False" Grid.Row="1" CanUserAddRows="False"
ItemsSource="{Binding Model.FlatModel}" IsReadOnly="True" GridLinesVisibility="None" HeadersVisibility="Column" SelectionUnit="FullRow" CanUserSortColumns="False" RowHeight="20" >
<DataGrid.CellStyle>
<Style TargetType="DataGridCell">
<Setter Property="BorderThickness" Value="0"/>
<Setter Property="Foreground" Value="Black"/>
<Setter Property="FocusVisualStyle" Value="{x:Null}"/>
</Style>
</DataGrid.CellStyle>
<DataGrid.RowStyle>
<Style TargetType="DataGridRow" BasedOn="{StaticResource {x:Type DataGridRow}}">
<Setter Property="ContextMenu" Value="{StaticResource cm}"/>
</Style>
</DataGrid.RowStyle>
<DataGrid.Resources>
<SolidColorBrush x:Key="{x:Static SystemColors.HighlightBrushKey}"
Color="#A6D8FF"/>
<Style TargetType="DataGridColumnHeader">
<Setter Property="HorizontalContentAlignment" Value="Center"/>
</Style>
</DataGrid.Resources>
<DataGrid.Columns>
</DataGrid.Columns>
</DataGrid>
字符串
1条答案
按热度按时间k3fezbri1#
如果此上下文菜单,它工作得很好,即使在同一时间选择多个项目.
字符串