I have a drop down button that contains a context menu as the drop down content. I'm binding my ItemsSource of the ContextMenu to a collection of Items on my view model. Because it's inside a DropDownButton, I'm handling the ItemClick event to close the drop down. But I'd like to also use a command on my view model and pass the bound object as the parameter.
Right now, I'm using a DataTemplate, but then I get a menuItem inside a menuItem.
Here is my button and context menu code.
How can I do the same thing as above without getting a menuItem inside a MenuItem?
Right now, I'm using a DataTemplate, but then I get a menuItem inside a menuItem.
Here is my button and context menu code.
<
telerik:RadDropDownButton
Content
=
"Assign"
DockPanel.Dock
=
"Right"
Margin
=
"3"
Name
=
"RolesMenu"
>
<
telerik:RadDropDownButton.DropDownContent
>
<
telerik:RadContextMenu
ItemsSource
=
"{Binding RolesList}"
ItemClick
=
"RolesMenu_ItemClick"
>
<
telerik:RadContextMenu.ItemTemplate
>
<
DataTemplate
>
<
telerik:RadMenuItem
Header
=
"{Binding RoleName}"
Command
=
"{Binding AssignRole}"
CommandParameter
=
"{Binding DataContext, RelativeSource={RelativeSource Mode=Self}}"
/>
</
DataTemplate
>
</
telerik:RadContextMenu.ItemTemplate
>
</
telerik:RadContextMenu
>
</
telerik:RadDropDownButton.DropDownContent
>
</
telerik:RadDropDownButton
>
How can I do the same thing as above without getting a menuItem inside a MenuItem?