Add a property to the RadGridView that provides a distinct template for adding a new row.
Sometimes you have classes with no default constructor. Those classes may have properties that are read-only after construction. This cannot be handled in the RadGridView, because you only have the choice of a CellEditTemplate. (I'm envisioning something akin to the RowDetailsTemplate.)
Example: I have a class that defines a invoice match for payment application. Once the invoice is set it cannot be changed. The user can still edit the match, but they're only allowed to edit the amount to be applied.
The content of the cell is set from .LoadContent() method and is returned from the CreateCellElement method of the column.
One possible scenario for a fix is to change that behavior and apply directly the template as WPF DataGrid does. However, this is a huge breaking change with CreateCellElement method is widely used. The second approach is to leave the code as it is right now, return the element from method of DataTemplate and set the ContentTemplate property of the cell to that DataTemplate. This will cause the content to be loaded twice. Which will degrade theUnhandled exception System.InvalidOperationException: The calling thread cannot access this object because a different thread owns it. at System.Windows.Threading.Dispatcher.VerifyAccess() at System.Windows.DependencyObject.GetValue(DependencyProperty dp) at Telerik.Windows.Data.SortDescriptorBase.get_SortDirection() at Telerik.Windows.Data.Expressions.SortDescriptorCollectionExpressionBuilder.Sort() at Telerik.Windows.Data.QueryableExtensions.Sort(IQueryable source, IEnumerable`1 sortDescriptors) at Telerik.Windows.Data.QueryableExtensions.Sort(IQueryable source, SortDescriptorCollection sortDescriptors) . . .
This behavior is reproducible when the SelectionUnit property of the RadGridView is set to "FullRow". SelectedCells collection is not of the selected row updated when new columns are added runtime. For example, you have selected the first row which has 3 cells. Then you add 2 new columns. Now the row has 5 cells but the selected cells collection still have 3. A possible workaround which can be used is to reset the SelectedItem property of the RadGridView. var selectedItem = testGrid.SelectedItem; testGrid.SelectedItem = null; this.testGrid.Columns.Add(new GridViewDataColumn() { Header = "Value3", DataMemberBinding = new Binding("Value3"), Width = 100 }); this.testGrid.Columns.Add(CreateColumn("Value4", "Value4")); testGrid.SelectedItem = selectedItem;