I am disabling checkboxes in the grid. Setting IsEnabled to false. How do I make it look like a windows checkbox when disabled. You know, kind of grayed out.
Hi singlemalt,
I apologize in advance because I'm not very sure I've got your idea.
Here's how I see it - you don't need to disable the checkbox only if its value is false anymore, but you need it disabled irrespective of the actual value. That's why I removed the trigger you use in your older posts. Then I have the following code which seems to work for this purpose:
<igDP:Field Name="Header1" Label="Flag" >
<igDP:Field.Settings>
<igDP:FieldSettings EditorType="{x:Type igEditors:XamCheckEditor}">
<igDP:FieldSettings.EditorStyle>
<Style TargetType="{x:Type igEditors:XamCheckEditor}">
<Style.Setters>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type igEditors:XamCheckEditor}">
<CheckBox HorizontalAlignment="Center" IsEnabled="False" IsChecked="{Binding Path=DataItem.Header1}"></CheckBox>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style.Setters>
</Style>
</igDP:FieldSettings.EditorStyle>
</igDP:FieldSettings>
</igDP:Field.Settings>
</igDP:Field>
Hope this helps.
To clarify, it appears gray but not checked although the binding is true/checked.
There is one problem now. If the checkbox is checked (from binding), it does not appear gray and checked. If I go back to my original code where the checkbox is disabled and read-only, the box can still be checked from binding. Is there a way to display it as checked and disabled.
That did it. Thanks.
I see what you mean. I tested this at my end and here's the solution I found.
What you can is replacing the 2 setters:
<Setter Property="IsReadOnly" Value="true" />
<Setter Property="IsEnabled" Value="false" />,
with the following:
<
Setter Property="Template">
<CheckBox HorizontalAlignment="Center" VerticalAlignment="Center" IsEnabled="False" />