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
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 |
.NET Framework: 4 |
Product Version:

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,



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,





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.
You must log in to leave a comment
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.

Up arrow icon

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

Live Chat Icon For mobile