Le code ci-dessous rend une cellule en gras lorsqu'elle est éditée avec succès.
style
<Style TargetType="Controls:DataGridCell"
BasedOn="{StaticResource {x:Type Controls:DataGridCell}}"
x:Key="CellBoldStyle">
<Style.Triggers>
<EventTrigger RoutedEvent="Binding.SourceUpdated">
<BeginStoryboard>
<Storyboard>
<ObjectAnimationUsingKeyFrames
Duration="00:00:00.5" Storyboard.TargetProperty
="(TextBlock.FontWeight)">
<DiscreteObjectKeyFrame KeyTime="00:00:00"
Value="{x:Static FontWeights.Normal}" />
<DiscreteObjectKeyFrame KeyTime="00:00:00.5"
Value="{x:Static FontWeights.Bold}" />
</ObjectAnimationUsingKeyFrames>
</Storyboard>
</BeginStoryboard>
</EventTrigger>
</Style.Triggers>
</Style>
Colonne
<Controls:DataGridTextColumn
Binding="{Binding Side, Mode=TwoWay,
NotifyOnTargetUpdated=True,
NotifyOnSourceUpdated=True}"
CellStyle="{StaticResource CellBoldStyle}" />
Je tiens particulièrement à changer la couleur de fond de la cellule dans le gestionnaire d'événement 'CellEditEnding' – Kishor
Quel est le motif de le faire? Ci-dessus aussi, au lieu de 'TextBlock.FontWeight', vous pouvez utiliser la propriété' BackGround'. Et au lieu de 'ObjectAnimationUsingKeyFrames', utilisez' ColorAnimation'. –