BoldSignEasily embed eSignatures in your .NET applications. Free sandbox with native SDK available.
Hi Tommie,
Thank you for contacting Syncfusion Support.
We have analyzed your query with your code snippet. In that the DataContext is not set for ContextMenu items. Hence the context menu is not worked as expected. However you can achieve your requirement for binding the SfDataGrid ContextMenu MenuItem to a command from my viewmodel by setting Source for Context Menu Item,
Code Snippet [XAML]:
<syncfusion:SfDataGrid.RecordContextMenu> <ContextMenu Style="{x:Null}"> <MenuItem Command="{Binding CopyCommand,Source={StaticResource employeeInfoViewModel}}" Header="Copy"></MenuItem> </ContextMenu> </syncfusion:SfDataGrid.RecordContextMenu> |
C#:
CopyCommand = new ContextMenuDemo.ContextMenuCommands.RelayCommand(ShowMessage);
private ICommand copyCommand;
public ICommand CopyCommand { get { return copyCommand; } set { copyCommand = value; } }
public void ShowMessage(object obj) { //Do your actions here } |
We have also prepared the sample based on this which is available from the below location,
Sample: http://www.syncfusion.com/downloads/support/directtrac/142870/ze/ContextMenuDemo-1972320366
Please let us know if you need further assistance.
Thank you,
Jai Ganesh S