I'm working with the wpf toolkit datagrid and have a column that is populated with toggle buttons. Using the below style I change the background color if the toggle button is selected and also on mouse over. Unfortunately if I have virtualization enable, when I make a select of a toggle button in a cell and scroll down in the grid I will find other cells that have also had their background changed. I assume this is a bug in how virtualization is reusing the cells as I scroll. Any suggestion to get around this and still use virtualization?
<Style TargetType="{x:Type ToggleButton}">
<Setter Property="Control.Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type ToggleButton}">
<TextBlock x:Name="Tb" Tag="{TemplateBinding Property=Tag}" Padding="{TemplateBinding Property=Padding}" Text="{TemplateBinding Property=Content}" >
</TextBlock>
<ControlTemplate.Triggers>
<Trigger Property="IsMouseOver" Value="True">
<Setter TargetName="Tb" Property="Background" Value="{StaticResource HoverRed}" />
</Trigger>
<Trigger Property="IsChecked" Value="True">
<Setter TargetName="Tb" Property="Background" Value="{StaticResource SelectYellow}" />
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>