Is it possible to enable a cell control based(this again is a combo in the templatecolumn) on the value selected in the combo of the xamgrid
I am using the cellcontrolattached and for the initial load i get the control disabled or enabled correctly
But when i change the value of the combo in xamgrid the cell does not enable or disable
Which event needs to be triggered for this?
I'm assuming the ComboBox is actually bound to a field. Are you raising the PropertyChagned event for that property when it changes? B/c if not the CellControlAttached event won't get raised.
-SteveZ
" Are you raising the PropertyChagned event for that property when it changes.."
By this do you mean when the SelectionChanged occurs for that combo?
Hi,
I'm assuming your ComobBox's SelectedItem is bound to the underlying field of your data for that row.
If so, when that item changes, are you raising the PropertyChanged event.
The propertyChangedEvent is raised
So, the CellControlAttached event will be raised for the combo then.
You could then detect if the combo column is changing (as thats the one determining whether the other cell should be enabled/disabled) and you can set the style on that particular cell.
I am doing something like
xxx data = e.Cell.Row.Data as xxx;
if ((data.field1!= 1 && data.field1!= 2)) {
e.Cell.Column.AllColumns["field2"].CellStyle = Application.Current.Resources["mystyle"] as Style; e.IsDirty = true;
}
But AllColumns count is always 0
If I check the column key then it doe snot identify the value of other column
Any ideas?
You're looking at the Columns collection on the Column, which would only contain children columns of that Column, for example if e.cell.Column was a GroupColumn;
Also, you're trying to apply a style to an entire column, which i don't think you want to do. You'd just like to apply it to a cell in the same row, right?
So it should be something like:
e.Cell.Row.Cells["field2"].CellStyle = ....
Also, don't set the e.IsDirty flag. As thats only neccessry if you mess with the e.Cell.Control that is being attached in the event.
If i use the e.Cell.Row.Data then it shows the existing value in the xamgrid or data in db
How can I retrieve the value that user is trying to enter
The vent is triggered fine its just the value that it checks is against old value, it if uses the new value code would work just fine