Is there any way to handle a right click on a cell?
Thanks for the answer.
Perhaps there is a way to select a row with the right button?
We regret that we will be unable to implement the feature "Provide an event support to listen the mouse right click" in our 2023 Volume 1 main release, as promised. The feature will be included in our 2023 Volume 1 SP release, which is scheduled for the end of April 2023. We will notify you once the feature is available. We appreciate your understanding until then.
Due to complexities to provide support in MacCatalyst, we are unable to include the feature in Volume 1 SP release. We will complete and implement the feature in Volume 2 release which is scheduled on end of June 2023. We appreciate your patience until then.
We apologize for not being
able to include the mentioned feature in our 2023 Volume 2 main release as
initially promised. Instead, it will be incorporated into our 2023 Volume 2 SP
release, planned in the month of August 2023. Once the feature is available, we will inform
you. In the meantime, we appreciate your patience and understanding.
We are glad to announce that our Essential Studio 2023 Volume 2 Service Pack Release V22.2.5 is rolled out with the implementation of “RightClick” support in SfDataGrid and is available for download under the following link.
We are pleased to share that we have attached a sample project and a code snippet for your reference. These resources demonstrate how users can effectively utilize the RightClick Event in SfDataGrid. This event allows users to implement custom functionalities and interactions when users right-click on specific elements within the DataGrid. We hope that the provided sample and code snippet will assist you in incorporating this feature into your application with ease.
dataGrid.CellRightTapped += DataGrid_CellRightTapped;
private void DataGrid_CellRightTapped(object sender, Syncfusion.Maui.DataGrid.DataGridCellRightTappedEventArgs e)
//Your code here
We thank you for your support and appreciate your patience in waiting for this release. Please get in touch with us if you would require any further assistance.
It Works! 😍
We are glad to know that the reported problem has been resolved at your end. Please let us know if you have any further queries on this. We are happy to help.
Yes, it works, thank you. But there is an issue.
My task is to get a context menu for a selected item. To do this, I need to select a row by right-clicking.
I'm doing it like this:
dataGrid.SelectedIndex = e.RowColumnIndex.RowIndex;
Everything is fine, it works.
But if I change the collection bind to ItemSource, when I right-click on this row, I get an error: "System.InvalidOperationException: 'RowData is null in Find is not a valid operation'"
SelectedItem is also bind as TwoWay, and when I make changes in my VM, I get the same error on the line:
Despite the fact that the data is there, the value in SelectedItem is correct.
Interesting. Left-click for selection works as expected, no errors. And after left-click, right-click also functions normally.
Changing the item source at runtime may result in a "System.NullReferenceException: 'Object reference not set to an instance of an object" exception within the DataGrid. This was a known issue on our end, alongside other item source manipulation issues. We've addressed all of these issues, and the fix will be incorporated into our upcoming Vol. 3 release, expected in mid-September.
However, based on the information you've provided, it appears that the exception you're encountering might be different from the one we've addressed. To provide you with more accurate assistance, we kindly request that you share the stack trace associated with the problem. This will enable us to compare it with the previous exception and work towards a more feasible solution for your specific case.
System.InvalidOperationException HResult=0x80131509 Message=RowData is null in Find is not valid operation Source=Syncfusion.Maui.DataGrid StackTrace: at Syncfusion.Maui.DataGrid.GridSelectedRowsCollection.Find(Object rowData) at Syncfusion.Maui.DataGrid.GridSelectedRowsCollection.Contains(Object rowData) at Syncfusion.Maui.DataGrid.DataGridRowSelectionController.<>c__DisplayClass27_0.