Infragistics(R) NetAdvantage(R) : WPF 2012.1
Adding Check Boxes to XamMenuItems
E-mail your feedback on this topic.
Shared XAML > Menus > xamMenu > Using xamMenu > Adding Check Boxes to XamMenuItems

Glossary Item Box

You can display check boxes for each of xamMenu's items. This require setting the IsCheckable property to true on the XamMenuItem object. Each XamMenuItem object has a Checked event that you can handle to provide custom functionality when the end user checks an item. Further, each item has an IsChecked property you can use to determine its check state or to set its check state in code.

The following code shows you how to display check boxes for items in xamMenu.

In XAML:

<ig:XamMenu x:Name="xamMenu1" Height="25" MenuOrientation="Horizontal">
   <!-- TODO: Add menu items-->
   <ig:XamMenuItem Header="View">
       <ig:XamMenuItem Header="Property Window" IsCheckable="True" />
       <ig:XamMenuItem Header="Editing Window" IsCheckable="True" />
   </ig:XamMenuItem>
</ig:XamMenu>

In Visual Basic:

' Create menu
Dim menu1 As New XamMenu()
Me.LayoutRoot.Children.Add(menu1)
menu1.Height = 25

' Create Shop menu item
Dim parentItem As New XamMenuItem()
parentItem.Header = "View"

menu1.Items.Add(parentItem)

' Create child menu item
Dim childItem As New XamMenuItem()
childItem.Header = "Property Window"
childItem.IsCheckable = True

parentItem.Items.Add(childItem)

' Create child menu item
childItem = New XamMenuItem()
childItem.Header = "Editing Window"
childItem.IsCheckable = True

parentItem.Items.Add(childItem)

In C#:

// Create menu
XamMenu menu1 = new XamMenu();
this.LayoutRoot.Children.Add(menu1);
menu1.Height = 25;

// Create Shop menu item
XamMenuItem parentItem = new XamMenuItem();
parentItem.Header = "View";

menu1.Items.Add(parentItem);

// Create child menu item
XamMenuItem childItem = new XamMenuItem();
childItem.Header = "Property Window";
childItem.IsCheckable = true;

parentItem.Items.Add(childItem);

// Create child menu item
childItem = new XamMenuItem();
childItem.Header = "Editing Window";
childItem.IsCheckable = true;

parentItem.Items.Add(childItem);

Related Topics

Binding to Data

Layout Settings

Navigating Pages Using xamMenu

Adding and Removing Items

Adding Separators between XamMenuItems

Adding Icons to XamMenuItems