This question is locked. New answers and comments are not allowed.
Hi, I'm using a MVVM approach to complete the followign simple scenario:
I want all ReadOnly cells to have a certain style. The IsReadOnly property of my GridViewDataColumn is bound to a property in my VM. My ItemsSource is also changed in my VM, based on this property.
When the property changes, the ItemsSource changes, and new rows get populated. Then CellStyleSelector gets called:
however, at this point, the column's IsReadOnly property is not updated yet, so the cell's style is wrong.
The easiest solution I can think of is to reapply styles once the binding kicks in. How would I go about doing this?
I want all ReadOnly cells to have a certain style. The IsReadOnly property of my GridViewDataColumn is bound to a property in my VM. My ItemsSource is also changed in my VM, based on this property.
<telerik:GridViewDataColumn IsReadOnly="{Binding IsVMReadOnly}" DataMemberBinding="{Binding Column1}" CellStyleSelector="{StaticResource myCellStyle}"/>When the property changes, the ItemsSource changes, and new rows get populated. Then CellStyleSelector gets called:
public override Style SelectStyle(object item, DependencyObject container){ Telerik.Windows.Controls.GridView.GridViewCell cell = container as Telerik.Windows.Controls.GridView.GridViewCell; if (cell.Column.IsReadOnly) return ReadOnlyCellStyle; else return EditableCellStyle;}however, at this point, the column's IsReadOnly property is not updated yet, so the cell's style is wrong.
The easiest solution I can think of is to reapply styles once the binding kicks in. How would I go about doing this?