We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

right click on a cell

Is there any way to handle a right click on a cell?




13 Replies

KK Karthikraja Kalaimani Syncfusion Team February 10, 2023 10:44 AM UTC

Hi Nikolay, 

The .Net MAUI DataGrid does not have direct support for listening to GridCell mouse right-clicks. We have logged feature request for the same. We will implement the feature in our upcoming 2023 Volume 1 main release which is scheduled on end of April 2023. We will let you know once we provided support.

You can track the status of this report through the following feedback link, 
Regards,
Karthik Raja


NI Nikolay replied to Karthikraja Kalaimani February 10, 2023 05:56 PM UTC

Thanks for the answer.

Perhaps there is a way to select a row with the right button?



KK Karthikraja Kalaimani Syncfusion Team February 13, 2023 09:38 AM UTC

We regret to inform you that, there is no way to select a row with right click of mouse. We have logged feature request for the same. We will implement this feature in any of our upcoming release. We will let you know once we implemented the feature.You can track the status of this report through the following feedback link,  https://www.syncfusion.com/feedback/41071/provide-support-to-select-a-row-on-mouse-right-click



KK Karthikraja Kalaimani Syncfusion Team March 1, 2023 12:33 PM UTC

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.



KK Karthikraja Kalaimani Syncfusion Team May 5, 2023 12:04 PM UTC

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.



NY Nirmalkumar Yuvaraj Syncfusion Team June 23, 2023 06:56 AM UTC

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.



NY Nirmalkumar Yuvaraj Syncfusion Team July 28, 2023 01:22 PM UTC

Nikolay,


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.

Essential Studio 2023 Volume 2 Service Pack Release v22.2.5 is available for download | Announcements Forums | Syncfusion

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.

Code snippet:

public MainPage()

{

     InitializeComponent();

    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.


Regards,

Nirmalkumar


Attachment: DataGridMaui_2b0b5fa5.zip


SA Sachith July 31, 2023 09:28 AM UTC

It Works! 😍







NY Nirmalkumar Yuvaraj Syncfusion Team August 1, 2023 06:47 AM UTC

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.



NI Nikolay September 6, 2023 01:30 PM UTC

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:

OnPropertyChanged(nameof(SelectedItem));


Despite the fact that the data is there, the value in SelectedItem is correct.

upd.

Interesting. Left-click for selection works as expected, no errors. And after left-click, right-click also functions normally.



NY Nirmalkumar Yuvaraj Syncfusion Team September 7, 2023 11:51 AM UTC

Hi Nikolay,

 

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.

 

 

Regards,

Nirmalkumar



NI Nikolay replied to Nirmalkumar Yuvaraj September 7, 2023 03:42 PM UTC

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.

b__0(DataRowBase row) at System.Collections.Generic.List`1.ForEach(Action`1 action) at Syncfusion.Maui.DataGrid.DataGridRowSelectionController.InvalidateSelectionOfRow(Object rowData) at Syncfusion.Maui.DataGrid.DataGridRowSelectionController.ProcessSelectedIndexChanged(SelectionPropertyChangedHandlerArgs args) at Syncfusion.Maui.DataGrid.DataGridRowSelectionController.HandleSelectionPropertyChanges(SelectionPropertyChangedHandlerArgs args) at Syncfusion.Maui.DataGrid.SfDataGrid.OnSelectedIndexChanged(BindableObject bindable, Object oldValue, Object newValue) at Microsoft.Maui.Controls.BindableObject.SetValueCore(BindableProperty property, Object value, SetValueFlags attributes, SetValuePrivateFlags privateAttributes) at Microsoft.Maui.Controls.BindableObject.SetValue(BindableProperty property, Object value, Boolean fromStyle, Boolean checkAccess) at Microsoft.Maui.Controls.BindableObject.SetValue(BindableProperty property, Object value) at Syncfusion.Maui.DataGrid.SfDataGrid.set_SelectedIndex(Int32 value) at TDriveMAUI.View.Controls.Dashboard.NewFilesWidget.RightTapped(Object sender, DataGridCellRightTappedEventArgs e) in C:\Users\nikol\source\tdrivemaui\View\Controls\Dashboard\NewFilesWidget.xaml.cs:line 51 at Syncfusion.Maui.DataGrid.SfDataGrid.RaiseCellRightTapped(DataGridCellRightTappedEventArgs e) at Syncfusion.Maui.DataGrid.DataGridCell.OnRightTap(RightTapEventArgs e) at Syncfusion.Maui.Core.Internals.GestureDetector.PlatformView_RightTapped(Object sender, RightTappedRoutedEventArgs e) at WinRT._EventSource_global__Microsoft_UI_Xaml_Input_RightTappedEventHandler.EventState.b__1_0(Object sender, RightTappedRoutedEventArgs e) at ABI.Microsoft.UI.Xaml.Input.RightTappedEventHandler.Do_Abi_Invoke(IntPtr thisPtr, IntPtr sender, IntPtr e)


NY Nirmalkumar Yuvaraj Syncfusion Team September 8, 2023 11:45 AM UTC

Nikolay,

 

Based on the information you have provided, we've compared the stack trace to the issues we've previously encountered, but they don't match. We have been unable to reproduce the reported issue on our end. However, we understand that you are still experiencing difficulties, and we are committed to helping you resolve the issue as quickly as possible. In order to further investigate the problem, we kindly request that you provide us with the specific sample that is causing the issue. Alternatively, you can modify the attached sample to make it reproducible so that we can investigate and provide a solution in a timely manner.

 

Regards,

Nirmalkumar


Attachment: SfDataGridSample_90be2550.zip

Loader.
Up arrow icon