Hello all,
Have build an app where students can confirm that they are present. The datagrid shows a list of lessons the student is attending. The last column is a GridSwitchColumn.
The student can see if he/she was present.
The datagrid is bound to a viewmodel.
This works fine.
What I am not able to build is that a student is only allowed to switch to present in the row of today. Am able to check this condition. But am not able to disable the checkbox for other dates than today. Only after clicking (using event DataGrid_ValueChanged) am I able to mention to the user that it is not allowed but is too late in my perception of user friendlyness.
Have tried dataGrid.CurrentCellBeginEdit , dataGrid.CurrentCellActivating but all not fired for gridswitchcolumn.
Any suggestions are welcome. Greetings, Ronald
this.dataGrid.CellRenderers.Remove("Switch");
this.dataGrid.CellRenderers.Add("Switch", new CustomSwitchCellRenderer()); .... public class CustomSwitchCellRenderer : GridCellSwitchRenderer { protected override SfSwitchControl OnCreateDisplayUIView() { var switchControl = new SfSwitchControl(); switchControl.PropertyChanged += SwitchControl_PropertyChanged; return switchControl; } private void SwitchControl_PropertyChanged(object sender, PropertyChangedEventArgs e) { if (e.PropertyName == "Parent") { if ((((sender as SfSwitchControl).Parent as GridCell).DataColumn.RowData as Data).No_1 == 11) { (sender as SfSwitchControl).IsEnabled = false; } } } } |
Good evening,
Thanks a lot!
This works just I had asked.
Was busy with different methods but this works best.
Greetings
Ronald