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.
Anybody?
Hi singlemalt,
What you've done, i.e. setting the IsEnabled to false, should do the trick.
Please check the attachment to see what I get using the following template:
<
ControlTemplate TargetType="{x:Type igDP:CellValuePresenter}">
Could you, please let us know which NetAdvantage version you're using, and how your checkboxes appear?
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">
<Setter.Value>
<ControlTemplate TargetType="{x:Type igEditors:XamCheckEditor}">
<CheckBox HorizontalAlignment="Center" VerticalAlignment="Center" IsEnabled="False" />
</ControlTemplate>
</Setter.Value>
</Setter>
Hope this helps.
That did it. Thanks.
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.
To clarify, it appears gray but not checked although the binding is true/checked.
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">
<CheckBox HorizontalAlignment="Center" IsEnabled="False" IsChecked="{Binding Path=DataItem.Header1}"></CheckBox>
</Style.Setters>
</Style>
</igDP:FieldSettings.EditorStyle>
</igDP:FieldSettings>
</igDP:Field.Settings>
</igDP:Field>