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. (Last updated on : November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

How to bind the ItemSource for ContextMenu of SfdataGrid

SfDataGrid allows you to set the ContextMenus for Headers, Records, GroupCaption, GroupDropArea, GroupDropItem, GroupSummary, and TableSummary. Menu collections are bounded as ItemSource for ContextMenu with the ItemSource property binding. Refer the following code sample,

 XAML

 

Here, MenuList property can be accessed from ViewModel by setting StaticResource. ContextMenu for Header is set using SfDataGrid.HeaderContextMenu. Similarly ContextMenu can be set for Records, GroupCaption, GroupDropArea, GroupDropItem, GroupSummary, and TableSummary.

The following screenshot shows the ContextMenu of Header,

 

F:\KB\HeaderContextMenu.png

 

 

You can refer to the sample from the following location.

Sample Link: WPF

 

 

 

Article ID: Published Date: Last Revised Date: Platform: Control: .NET Framework: Product Version:
2430 08/06/2014 03/28/2017 WPF SfDataGrid 4 11.4.0.26
Did you find this information helpful?
Comments
Naushad Dowlut May 31, 2016
More helpful if sample showed how to bind the menu items to commands.
Reply
Sivakumar R [Syncfusion] Jul 20, 2016
Please refer the below kb which shows binding menu items to commands. Kb Link: https://www.syncfusion.com/kb/3245/how-to-copy-the-column-and-paste-it-as-a-new-column-by-contextmenu-in-sfdatagrid
Reply
Add Comment
You must log in to leave a comment

Warning Icon 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.Close Icon