Given a collection of the following type:
public class Entity{ public string Name { get; set; } public bool IsLocked { get; set; }}
I would like to lock (i.e. AllowEdit = false) and change the cell background of the Name field. I got it sort of working with the following XAML:
<ig:Field Name="Name" Label="Name"> <ig:Field.Settings> <ig:FieldSettings> <ig:FieldSettings.CellValuePresenterStyle> <Style TargetType="ig:CellValuePresenter"> <Style.Triggers> <DataTrigger Binding="{Binding Record.DataItem.IsLocked, RelativeSource={RelativeSource Self}}" Value="True"> <DataTrigger.Setters> <Setter Property="IsEnabled" Value="False" /> <Setter Property="Background" Value="Gray" /> </DataTrigger.Setters> </DataTrigger> </Style.Triggers> </Style> </ig:FieldSettings.CellValuePresenterStyle> </ig:FieldSettings> </ig:Field.Settings></ig:Field>
But this only changes the colour of the cell's border, not the cell's background. Is there a way to achieve this using a DataTrigger? Preferably manipulating the AllowEdit on the FieldSettings.
Thanks! That solved my problem. For reference, this is what I ended up doing:
<ig:Field Name="Name" Label="Name"> <ig:Field.Settings> <ig:FieldSettings> <ig:FieldSettings.EditorStyle> <Style TargetType="igEdit:ValueEditor"> <Style.Triggers> <DataTrigger Binding="{Binding DataContext.DataItem.IsLocked, RelativeSource={RelativeSource Self}}" Value="True"> <DataTrigger.Setters> <Setter Property="IsReadOnly" Value="True" /> <Setter Property="Background" Value="Gray" /> </DataTrigger.Setters> </DataTrigger> </Style.Triggers> </Style> </ig:FieldSettings.EditorStyle> </ig:FieldSettings> </ig:Field.Settings></ig:Field>