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.
Unfortunately, activation email could not send to your email. Please try again.

GridTemplateColumn will not show ContextMenu

Thread ID:

Created:

Updated:

Platform:

Replies:

130209 Apr 27,2017 03:11 PM Apr 28,2017 08:22 AM WPF 1
loading
Tags: SfDataGrid
Andy Swanson
Asked On April 27, 2017 03:11 PM

How do I get the ContextMenu to show in a SfDataGrid using a GridTemplateColumn and the grids EditTrigger is set to OnTap? If I set it to DoubleTap the menu will show. I want the same functionality setting the EditTrigger to OnTap.


Shobika Palani [Syncfusion]
Replied On April 28, 2017 08:22 AM

Hi Andy, 

Thank you for contacting Syncfusion Support. We have analyzed your query. Seems you are looking to show context menu of the element inside EditTemplate. You can achieve your requirement by overriding GridCurrentCellManager as like below code snippet 

Code Example: 

this.datagrid.SelectionController = new SelectionControllerExt(this.datagrid); 
 
public class CurrentCellManager : GridCurrentCellManager 
    { 
    
        public CurrentCellManager(SfDataGrid grid) : base(grid) 
        {  
        } 
 
        internal  void SetSuspendAndResumepdates(Action suspendupdates, Action resumeupdates) 
        { 
            SuspendUpdates = suspendupdates; 
            ResumeUpdates = resumeupdates; 
        } 
       
        public override void ProcessOnTapped(MouseButtonEventArgs e, RowColumnIndex currentRowColumnIndex) 
        { 
            if (dataGrid.EditTrigger == EditTrigger.OnTap && e.ChangedButton != MouseButton.Right) 
                base.ProcessOnTapped(e, currentRowColumnIndex); 
 
            if (CurrentRowColumnIndex == currentRowColumnIndex) 
            { 
                if (!(this.dataGrid is DetailsViewDataGrid)) 
                    ScrollInView(currentRowColumnIndex); 
            } 
        } 
    } 
 
    public class SelectionControllerExt : GridSelectionController 
    { 
        public SelectionControllerExt(SfDataGrid dataGrid) : base(dataGrid) 
        { 
        } 
 
        protected override GridCurrentCellManager CreateCurrentCellManager() 
        { 
            CurrentCellManager currentcellmanager = new CurrentCellManager(DataGrid); 
            currentcellmanager.SetSuspendAndResumepdates(SuspendUpdates,ResumeUpdates); 
            return currentcellmanager; 
        } 
    } 

Please let me know, if your requirement is different from above scenario. 

Thanks, 
Shobika P 


CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.

;