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

Platform: WPF |
Control: SfDataGrid |
Published Date: August 6, 2014 |
Last Revised Date: March 28, 2017 |
.NET Framework: 4 |
Product Version: 11.4.0.26

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

 

 

 

2X faster development

The ultimate WPF UI toolkit to boost your development speed.
ADD COMMENT
You must log in to leave a comment
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

Please sign in to access our KB

This page will automatically be redirected to the sign-in page in 10 seconds.

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