I have the following XAML for a context menu which has a DataTemplate to show custom menu content using a ContentPresenter, but it does not close when the content in the ContentPresenter is clicked, it only closes when I click on content outside of the ContentPresenter.
Why is this happening?
Also, why doesn't the ContentPresenter fill the available MenuItem header, even with 'Stretch' for both the horizontal & vertical alignment is does not fill the available space?
Thanks.
Why is this happening?
Also, why doesn't the ContentPresenter fill the available MenuItem header, even with 'Stretch' for both the horizontal & vertical alignment is does not fill the available space?
Thanks.
<
telerik:RadContextMenu.ContextMenu
>
<
telerik:RadContextMenu
x:Name
=
"radContextMenu"
Placement
=
"Bottom"
Visibility
=
"{Binding Path=HasContextMenu, Mode=OneWay, Converter={StaticResource BooleanToVisibilityConverter}}"
ItemsSource
=
"{Binding Path=ContextMenu, Mode=OneWay}"
>
<
telerik:RadContextMenu.Resources
>
<
DataTemplate
DataType
=
"{x:Type vm:MenuCustomViewModel}"
>
<
telerik:RadMenuItem
x:Name
=
"CustomMenuItem"
Command
=
"{Binding Path=Command, Mode=OneWay}"
>
<
telerik:RadMenuItem.Header
>
<
ContentPresenter
x:Name
=
"MenuContentPresenter"
Content
=
"{Binding Path=Content, Mode=OneWay}"
>
</
ContentPresenter
>
</
telerik:RadMenuItem.Header
>
</
telerik:RadMenuItem
>
</
DataTemplate
>
<
DataTemplate
DataType
=
"{x:Type vm:MenuSeparatorViewModel}"
>
<
Separator
/>
</
DataTemplate
>
</
telerik:RadContextMenu.Resources
>
</
telerik:RadContextMenu
>
</
telerik:RadContextMenu.ContextMenu
>