Como aplicar um estilo de célula ao celular DataGrid
Eu tenho o seguinteDataGrid
<DataGrid x:Name="cultureDataGrid"
Grid.Row="1"
CellStyle="{StaticResource DataGridCell}"
ItemsSource="{Binding Cultures,
NotifyOnSourceUpdated=True,
UpdateSourceTrigger=PropertyChanged,
Mode=TwoWay,
IsAsync=True}"
Style="{x:Null}" >
<DataGrid.Columns>
<DataGridTextColumn Header="Code" Binding="{Binding Code}" IsReadOnly="True"/>
<DataGridTextColumn Header="Language" Binding="{Binding Language}" IsReadOnly="True"/>
<DataGridTextColumn Header="LocalName" Binding="{Binding LocalName}" IsReadOnly="True"/>
</DataGrid.Columns>
</DataGrid>
Eu tenho o seguinte estilo de célula para alterar o selecionadoBackcolor
<Style TargetType="DataGridCell" BasedOn="{StaticResource {x:Type DataGridCell}}">
<Setter Property="Background" Value="White"/>
<Setter Property="VerticalContentAlignment" Value="Center"/>
<Style.Triggers>
<Trigger Property="IsSelected" Value="True">
<Setter Property="Background" Value="Red"/>
<Setter Property="Foreground" Value="White"/>
</Trigger>
</Style.Triggers>
</Style>
Eu tentei aplicar oCellStyle="{StaticResource DataGridCell}"
como mostrado acima, e usandoDynamicResource
mas o recurso não está sendo resolvido. Eu importei o dicionário de recursos correto como outros estilos estão trabalhandoO que eu estou fazendo errado aqui?
Obrigado pelo seu tempo.