DataConext binding for my RadContextMenu is being ignored. My menu is defined like this:
It works if I define it like this:
But this version displays a menu within a menu.
How can I get DataConext assigned on the outer menu?
<
UserControl.Resources
>
<
telerik:RadContextMenu
x:Key
=
"LimbContextMenu"
DataContext
=
"{Binding SelectedLimb}"
>
<
telerik:RadMenuItem
Header
=
"Expand"
Command
=
"{Binding ExpandItemCommand}"
/>
<
telerik:RadMenuItem
Header
=
"Expand to book"
Command
=
"{Binding ExpandToBookCommand}"
/>
<
telerik:RadMenuItem
Header
=
"Collapse"
Command
=
"{Binding CollapseItemCommand}"
/>
<
telerik:RadMenuItem
Header
=
"Collapse all"
Command
=
"{Binding CollapseAllCommand}"
/>
<
telerik:RadMenuItem
Header
=
"Jump to home"
Command
=
"{Binding JumpToHomeCommand}"
Visibility
=
"{Binding JumpToHomeCommand.IsSupported, Converter={StaticResource BooleanToVisibilityConverter}}"
/>
</
telerik:RadContextMenu
>
</
UserControl.Resources
>
It works if I define it like this:
<
UserControl.Resources
>
<
telerik:RadContextMenu
x:Key
=
"LimbContextMenu"
>
<
telerik:RadContextMenu
DataContext
=
"{Binding SelectedLimb}"
>
<
telerik:RadMenuItem
Header
=
"Expand"
Command
=
"{Binding ExpandItemCommand}"
/>
<
telerik:RadMenuItem
Header
=
"Expand to book"
Command
=
"{Binding ExpandToBookCommand}"
/>
<
telerik:RadMenuItem
Header
=
"Collapse"
Command
=
"{Binding CollapseItemCommand}"
/>
<
telerik:RadMenuItem
Header
=
"Collapse all"
Command
=
"{Binding CollapseAllCommand}"
/>
<
telerik:RadMenuItem
Header
=
"Jump to home"
Command
=
"{Binding JumpToHomeCommand}"
Visibility
=
"{Binding JumpToHomeCommand.IsSupported, Converter={StaticResource BooleanToVisibilityConverter}}"
/>
</
telerik:RadContextMenu
>
</
telerik:RadContextMenu
>
</
UserControl.Resources
>
But this version displays a menu within a menu.
How can I get DataConext assigned on the outer menu?