Hi,
I am trying to create a GridView with both Cell and CellEdit templates for one of the columns. The problem that I am experiencing is two fold:
1. If I bind the column AND the CellTemplate to the same property, I noticed that the IDadaErrorInfo indexer gets called twice per "Name" cell. This is a problem as the validation logic is not particularly straight forward and starts to create a performance issue once there are few dozen rows:
<telerik:GridViewDataColumn DataMemberBinding="{Binding Name}">
<telerik:GridViewDataColumn.CellTemplate>
<DataTemplate>
<TextBlock Text="{Binding Name, ValidatesOnDataErrors=True, Mode=OneWay, UpdateSourceTrigger=PropertyChanged}" />
</DataTemplate>
</telerik:GridViewDataColumn.CellTemplate>
<telerik:GridViewDataColumn.CellEditTemplate>
<DataTemplate>
<TextBox Text="{Binding Name, ValidatesOnDataErrors=True, Mode=TwoWay, UpdateSourceTrigger=LostFocus}" />
</DataTemplate>
</telerik:GridViewDataColumn.CellEditTemplate>
</telerik:GridViewDataColumn>
2. Removing the DataMemberBinding from the column and keeping it in the CellTemplate works fine when it comes to displaying the data, but does not seem to work with the IDataErrorInfo. I can see the indexer get called, however I do not see the validation error reflect in the UI. Which effectively means that the validation can only be shown in CellEditTemplates:
<telerik:GridViewDataColumn>
<telerik:GridViewDataColumn.CellTemplate>
<DataTemplate>
<TextBlock Text="{Binding Name, ValidatesOnDataErrors=True, Mode=OneWay, UpdateSourceTrigger=PropertyChanged}" />
</DataTemplate>
</telerik:GridViewDataColumn.CellTemplate>
<telerik:GridViewDataColumn.CellEditTemplate>
<DataTemplate>
<TextBox Text="{Binding Name, ValidatesOnDataErrors=True, Mode=TwoWay, UpdateSourceTrigger=LostFocus}" />
</DataTemplate>
</telerik:GridViewDataColumn.CellEditTemplate>
</telerik:GridViewDataColumn>
What is the correct way of setting up Cell and CellEdit template binding to display IDataErrorInfo errors in both edit and non-edit mode at all times, while not having the IDataErrorInfo indexer getting hit twice as much as it should?
Thanks in advance,
Ross