Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
405
Using Infragistics default style for XamContextMenu, menu item checkboxes no longer checkable
posted

I am using Infragistics default style for XamContextMenu, after setting the  context menu as follows,

<ig:XamContextMenu Name="_navigatorContextMenu"
Style="{StaticResource DarkContextMenuStyle}"
ItemContainerStyle="{StaticResource PurpleMenuItemStyle}"
Opening="XamContextMenu_Opening">

menu item checkboxes no longer checkable. If I remove the ItemContainerStyle="{StaticResource PurpleMenuItemStyle}", they are again checkable.

I have attached sample showing this issue. Run the sample and right-click the menu to see the context menu. All the items should show initially checked but none of them are and user cannot click to change the state of the checkbox. If you remove the ItemContainerStyle="{StaticResource PurpleMenuItemStyle}" from the XamContextMenu XAML you will see the checkmarks.

I tried  playing with the section (below) in default style supplied by Infragistics but can't get the behavior to function correctly.

<ContentPresenter x:Name="HeaderCheckboxPresenter"
Margin="4,3,4,3"
HorizontalAlignment="Right"
VerticalAlignment="Center"
Visibility="{TemplateBinding CheckBoxVisibilityResolved}">
<ContentPresenter.ContentTemplate>
<DataTemplate>
<CheckBox IsHitTestVisible="False" IsChecked="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=IsChecked, Mode=TwoWay}"/>
</DataTemplate>
</ContentPresenter.ContentTemplate>
</ContentPresenter>

Please see attached file XamMenuFun.zip for the sample demonstrating the issue.

Thank you for any help.

--Pat

xamMenuFun.zip
Parents
No Data
Reply
  • 405
    Verified Answer
    posted

    Hi Pat,

    To fix the issue you need to make two changes to your code:

    1) You've set IsHitTestVisible to False in the check box inside PurpleMenuItemStyle (line 283). You can remove this property setter or change it to True.

    2) There is an issue with the binding that you are using for the Checkbox element. You need to use Ancestor binding because the parent element is ContentPresenter.

    After making those two changes, the check box should look like this:

    <CheckBox IsChecked="{Binding RelativeSource={RelativeSource AncestorType={x:Type ig:XamMenuItem}}, Path=IsChecked, Mode=TwoWay}"/> 

    Let me know if you have any other questions.

    Sincerely,

    Lazar Nikolov

    Infragistics

    www.infragistics.com/support

Children