make popup like context menu

I am currently working with .NET MAUI and would like to implement a popup similar to a context menu using Syncfusion controls. Specifically, I need to show a popup when the user long presses on a control  and the popup should contain menu items that the user can select from.

Can you please provide guidance on how to use Syncfusion’s popup components to create a context menu-like behavior? If possible, I would appreciate a sample or code snippet that demonstrates how to handle the long press gesture and display the popup with menu items.



3 Replies

AF Anees Fathima Shajahan Syncfusion Team December 26, 2024 11:42 AM UTC

Hi Customer,


You can display the context menu using our SfPopup (with the required menu items) triggered by a long press. For more information, please refer to the attached KB link, which demonstrates how to display the popup as a context menu. The ItemLongPress event of SfListView is used to show the popup context menu.

If you have any further questions, feel free to contact us.

KB link: How to show context menu for items in .NET MAUI ListView (SfListView)?

Popup UG : Getting Started with .NET MAUI Popup control | Syncfusion


Regards,

Anees Fathima.



NT Nguy?n Th?nh December 27, 2024 02:33 AM UTC

hi have a problem that my ItemsLayout i'm using is GridLayout and i have no idea to accees GridViewInfo. Canyou assist me?



AF Anees Fathima Shajahan Syncfusion Team December 27, 2024 11:26 AM UTC

Hi Customer,


To display a popup as a context menu in a ListView with a GridLayout, we recommend positioning the popup at the touch position obtained from the long-press event. Ensure the status bar height is excluded to calculate the exact touch position.

Refer to the provided code snippet and sample for more details, and feel free to reach out if you have any further questions.


        

ListView.ItemLongPress += ListView_ItemHolding;

 

private void ListView_ItemHolding(object sender, ItemLongPressEventArgs e)

{


            var statusBarHeight = _statusBarService.GetStatusBarHeight();

            var y = e.Position.Y - (statusBarHeight);

 

            popupLayout.Show(e.Position.X, y);

}


Regards,

Anees Fathima.


Attachment: ListViewMaui_395c0b04.zip

Loader.
Up arrow icon