Hi Team,
I am currently adding a context menu item on XamDataGrid's header as below. The context Menu contains a few menu items which binded to a command. However, my menu item command needs to use current selected header field. How can I get that via binding?
<
Style TargetType="{x:Type igDP:LabelPresenter}" BasedOn="{x:Static Themes:DataPresenterOffice2k7Blue.LabelPresenter}"
>
Setter Property="ContextMenu" Value="{StaticResource headerContextMenu}"/>
</Style
ContextMenu x:Key="headerContextMenu"
MenuItem Header="Some Action Menu"
MenuItem Header="All" Command="{Binding DoActionCommand}"/>
</
ContextMenu>
Hello,
I am just checking the progress of this issue and was wondering if you managed to achieve your goal or if you need any further assistance on the matter.
Hello Xin,
Thank you for your post. I have been looking into it and I can suggest you set the MenuItem’s CommandParameter like this:
CommandParameter="{Binding RelativeSource={RelativeSource AncestorType={x:Type igDP:LabelPresenter}}}"
And this way the parameter in the Execute method of the Command will be the LabelPresenter. Please let me know if this helps you or you need further assistance on this matter.
Looking forward for your reply.