Hi Jenny,
thanks for your answer, but that does not do the trick.
If the column has ReadOnly=true, setting InsertionRow.ReadOnly=false will have no effect.
Here's the code I use:
private
void InitializeGrid()
{
jwpGridTZBJeEART.Columns.Create(
"SubEnergyKind", Core.Resources.Energy.SubEnergyKind(), "E_ART1", new JWPGrid.Editors.JWPDataGridControlComboBoxCellEditor(_subEnergyKindDataSource)).ReadOnly = true;
// Create the insertion row.
DataTemplate NewDataTemplate = new DataTemplate();
FrameworkElementFactory NewInsertionRow = new FrameworkElementFactory(typeof(JWPDataGrid.InsertionRow));
NewInsertionRow.SetValue(JWPDataGrid.
InsertionRow.ReadOnlyProperty, false);
NewDataTemplate.VisualTree = NewInsertionRow;
jwpGridTZBJeEART.View.FixedHeaders.Add(NewDataTemplate);
_dataGridCollectionView = jwpGridTZBJeEART.CreateDataGridCollectionView(_facade.saldo_tzbDataTable.DefaultView,
typeof(DataRowView));
_dataGridCollectionView.ItemProperties.Add(
new JWPDataGrid.DataGridItemProperty("SubEnergyKind", "E_ART1", typeof(string), true));
jwpGridTZBJeEART.InitializingInsertionRow +=
new EventHandler<Xceed.Wpf.DataGrid.InitializingInsertionRowEventArgs>(jwpGridTZBJeEART_InitializingInsertionRow);
}
void
jwpGridTZBJeEART_InitializingInsertionRow(object sender, Xceed.Wpf.DataGrid.InitializingInsertionRowEventArgs e)
{
e.InsertionRow.Cells[
"SubEnergyKind"].CellValidationRules.Add(new SubEnergyKindValidationRule(jwpGridTZBJeEART));
e.InsertionRow.ReadOnly =
false;
}
"Columns.Create" is a little method I wrote to simplify column creation.
The InitializingInsertionRow-Event will only fire if the insertion row switches to edition mode.
The ComboBox-CellEditor shall only be active in the insertion row.
Any other options I can try?
Thanks,
Michael