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>
Hello,
Please take a look at the following thread:
http://forums.infragistics.com/forums/p/25409/93305.aspx#93305
I believe it is the same issue. I would also suggest creating a style for the ValueEditor and setting the IsEnabled property of the editor, rather than the CellValuePresenter.
Let me know if you need any more assistance or have questions on this matter.
Regards,
Alex.