I have read many previous post and have tried to add a style with control template to replace the standard xamCheckEditor with a path. All my xamCheckEditor instances in my xamDataGrid arrive from binding with a datasource, nothing is unbound.
Here is the XAML:
<Style x:Key="xamCheckEditorStyle" TargetType="{x:Type igEditors:XamCheckEditor}"> <Setter Property="Template"> <Setter.Value> <ControlTemplate x:Key="boolKey" TargetType="{x:Type igEditors:XamCheckEditor}"> <Grid> <Ellipse x:Name="CheckBoxCircle" Width="30" Height="30" Fill="Green" Stretch="UniformToFill" Margin="1" HorizontalAlignment="Center" VerticalAlignment="Center"/> </Grid> <ControlTemplate.Triggers> <Trigger Property="IsChecked" Value="True"> <Setter TargetName="CheckBoxCircle" Property="Fill" Value="Red"/> </Trigger> </ControlTemplate.Triggers> </ControlTemplate> </Setter.Value> </Setter> </Style>
What am I doing wrong?
Hello Ed and thank you for posting!
The control template should not include a key attribute as in the provided code snippet. I have removed it and the template was correctly applied. You can have a look at the attached sample project for your reference. Also make sure that you have added the style as resource to the field. It will not be automatically applied because of the key.I hope this is helpful. If you need further assistance, let me know.
Thanks, that works great.