Represents the usage of the NavigationPaneOptionsControlCommands buit-in commands
Private Sub AssignCommandToMenuItem(ByVal menuItem As MenuItem, ByVal command As String, ByVal navPaneOptions As NavigationPaneOptionsControl)
Select Case command
Case "Save"
menuItem.Command = NavigationPaneOptionsControlCommands.CommitChangesAndCloseCommand
Exit Sub
Case "Down"
menuItem.Command = NavigationPaneOptionsControlCommands.MoveSelectedDownCommand
Exit Sub
Case "Up"
menuItem.Command = NavigationPaneOptionsControlCommands.MoveSelectedUpCommand
Exit Sub
Case "Reset"
menuItem.Command = NavigationPaneOptionsControlCommands.ResetGroupSequenceAndVisibilityCommand
Exit Sub
End Select
menuItem.CommandTarget = navPaneOptions
End Sub
void AssignCommandToMenuItem(MenuItem menuItem, string command, NavigationPaneOptionsControl navPaneOptions)
{
switch (command)
{
case "Save":
menuItem.Command = NavigationPaneOptionsControlCommands.CommitChangesAndCloseCommand;
break;
case "Down":
menuItem.Command = NavigationPaneOptionsControlCommands.MoveSelectedDownCommand;
break;
case "Up":
menuItem.Command = NavigationPaneOptionsControlCommands.MoveSelectedUpCommand;
break;
case "Reset":
menuItem.Command = NavigationPaneOptionsControlCommands.ResetGroupSequenceAndVisibilityCommand;
break;
}
menuItem.CommandTarget = navPaneOptions;
}
This sample ilustrates how to create a custom 'Navigation Pane Options' window, NavigationPaneOptionsControl styling, using NavigationPaneOptionsControlCommands and context menu to change order of groups.
<Window x:Class="XamOutlookBarApp.WindowOptions"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:igOutlookBar="http://infragistics.com/OutlookBar"
Title="WindowOptions" Height="300" Width="516" WindowStartupLocation="CenterOwner"
>
<Window.CommandBindings>
<!-- Used to close this window from a menu -->
<CommandBinding Command="ApplicationCommands.Close"
CanExecute="AlwaysCanExecute"
Executed="CloseWindowOptions"
/>
</Window.CommandBindings>
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="Auto" MinHeight="21" />
<RowDefinition/>
</Grid.RowDefinitions>
<Grid.Resources>
<!-- This style removes buttons from the NavigationPaneOptionsControl -->
<Style TargetType="igOutlookBar:NavigationPaneOptionsControl">
<Setter Property="Width" Value="Auto"/>
<Setter Property="Height" Value="Auto"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type igOutlookBar:NavigationPaneOptionsControl}">
<Grid>
<ListBox x:Name="PART_ListBox" Background="AntiqueWhite"/>
</Grid>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
</Grid.Resources>
<!-- This menu exposes functionality of NavigationPaneOptionsControl buttons -->
<Menu>
<MenuItem Header="OutlookBar Options">
<MenuItem Header="Reset Visibility and Order"
Command="{x:Static igOutlookBar:NavigationPaneOptionsControlCommands.ResetGroupSequenceAndVisibilityCommand}"
CommandTarget="{Binding ElementName=navPaneOptions}"
/>
<MenuItem Header="Save Options"
Command="{x:Static igOutlookBar:NavigationPaneOptionsControlCommands.CommitChangesAndCloseCommand}"
CommandTarget="{Binding ElementName=navPaneOptions}"
/>
<MenuItem Header="Quit"
Command="ApplicationCommands.Close"
/>
</MenuItem>
<MenuItem x:Name="menuItem" Header="MenuItem"/>
</Menu>
<igOutlookBar:NavigationPaneOptionsControl x:Name="navPaneOptions" Grid.Row="1">
<igOutlookBar:NavigationPaneOptionsControl.ContextMenu>
<!-- ContextMenu used to move items up and down -->
<ContextMenu>
<MenuItem Header="Move Up"
Command="{x:Static igOutlookBar:NavigationPaneOptionsControlCommands.MoveSelectedUpCommand}"
CommandTarget="{Binding ElementName=navPaneOptions}"
/>
<MenuItem Header="Move Down"
Command="{x:Static igOutlookBar:NavigationPaneOptionsControlCommands.MoveSelectedDownCommand}"
CommandTarget="{Binding ElementName=navPaneOptions}"
/>
</ContextMenu>
</igOutlookBar:NavigationPaneOptionsControl.ContextMenu>
</igOutlookBar:NavigationPaneOptionsControl>
</Grid>
</Window>
Target Platforms: Windows 10, Windows 8.1, Windows 8, Windows 7, Windows Server 2012, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2