I would like to set the back color of a cell to gray for all not editable cells ( cell.Filed.Settins.AllowEdit = false).
Setting one cell of a column to gray using the CellValuePresenterStyle will set the whole column to gray.
-> is this a bug, or is it not possible to set the column style individually per cell?
Stefan
Stefan,
This is because the AllowEdit is a property of the Field object and can't be set for an individual cell. When you set this to false it disable editing for all of the cells in the column or in the grid.
One option is to create a style for the CellValuePresenter and bind the IsEnabled property to the cell's value using converter. You can do the same thing for the Background property.
For more details check out the following forum thread:
http://blogs.infragistics.com/forums/p/24960/91483.aspx
Let me know if you have any questions with this matter.
Thanks for your help.
After initializing or changing the collection of the _dataGrid.DataSource, I would like to visualize some cells as disabled(not editable, not used) independently of the Value of the cell:
bool disabled = coming from logic of view model of each datarecord
DataRecord r = _dataGrid.Records[0] as DataRecord
r.Cells["Key_Address"]. ?? = disabled
Is this possible?
Just following up on this thread. Please let me know if you require further assistance.
In that case you may try to obtain the CellValuePresenter from a specific cell like that:
CellValuePresenter cvp=
CellValuePresenter.FromCell((xamDataGrid1.Records[0] as DataRecord).Cells[0]);
cvp.IsEnabled = false;
Please, note that this might not work when scrolling vertically in the grid because of the virtualization.