Posted 27 November 2017, 2:27 am EST
Hi,
I am using a flexgrid in my application.I just wanted to deselect the selection from the grid and also i dont want to edit the column in a flexgrid. Any one help me how to do it.
Forums Home / ComponentOne / ComponentOne Studio for Xamarin
Posted by: manoharb on 27 November 2017, 2:27 am EST
Posted 27 November 2017, 2:27 am EST
Hi,
I am using a flexgrid in my application.I just wanted to deselect the selection from the grid and also i dont want to edit the column in a flexgrid. Any one help me how to do it.
Posted 27 November 2017, 5:09 am EST
Hello
The following code should remove selection and cancel any edits:
grid.Select(new GridCellRange(-1, -1) , false);
grid.FinishEditing(true);
If you want to commit the edits pass false to FinishEditing instead.
Thanks
Kelley
Posted 30 November 2017, 12:37 am EST
Hi Kelley,
Thanks for the reply.I used the FinishEditing(true) method in my code but it is not restricting the column to edit . I am using the FinishEditing(true) method in BeginningEdit event handler.
here is my code
private void _flexGrid_BeginningEdit(object sender, GridCellRangeEventArgs e)
{
(sender as FlexGrid).FinishEditing(true);
}
Correct me if I am handling it wrongly.
Thanks.
Posted 30 November 2017, 1:02 am EST
Hi Manoharb
Is your end goal to prevent all editing? From you code that looks like what you’re attempting.
Both the FlexGrid and the individual columns have an IsReadOnly property that you can use to prevent editing. I think that would be a much easier way of preventing edits if that’s your goal. If you’re trying to do something else can you provide some more information for your use case?
Thanks
Kelley