Hi Guys,
I am using 3.7 wpf datagrid control.
I have a bound datagrid control with four columns. First column is checkbox, 2nd is read only and 3rd & 4th are editable columns with textbox editor.
Now I want user to allow cell of 3rd & 4th columns only if checkbox is checked in first column.
I don't want to user to start editing values in 3rd and 4th columns without selecting checkbox field.
Any idea? how can I achieve this?
i tried implementing checkbox template and handling checkbox checked event as folllow:
private void CheckBox_Checked(object sender, RoutedEventArgs e)
{
DataRow dr = mygrid.GetContainerFromItem(mygrid.CurrentItem) as DataRow;
if (dr != null)
{
Cell cel = dr.Cells[2];
if (cel != null)
{
cel.ReadOnly = false;
cel.BeginEdit();
}
}
}
but I am getting below error as I kept columns read only
"An attempt was made to edit a read-only cell or the cell content is not bound using two way binding."
Thanks