Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
1015
Trying to use replace xamCheckEditor with Image
posted

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?

Parents
  • 17475
    Verified Answer
    Offline posted

    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.

    XamDataGridCheckbox.zip
Reply Children