Version

MenuItemSeparatorStyleKey Field

The key used to identify the System.Windows.Style for System.Windows.Controls.Separator instances that are submenu items within the XamDockManager.
Syntax
'Declaration
 
Public Shared ReadOnly MenuItemSeparatorStyleKey As ResourceKey
public static readonly ResourceKey MenuItemSeparatorStyleKey
Example
This example uses the ContentPane's OptionsMenuOpening event to add a menu item to the built in context menu shown for a pane.

For an overview of how to handle events in Visual Basic or Visual C#, see Event Handlers in Visual Basic and Visual C#. For specific information and code examples illustrating how to consume events in your application, see Consuming Events in the .NET Framework Developer's Guide.

Imports Infragistics.Windows.DockManager
Imports Infragistics.Windows.DockManager.Events

Private Sub ContentPane_OptionsMenuOpening(ByVal sender As Object, ByVal e As PaneOptionsMenuOpeningEventArgs)
    Dim cp As ContentPane = TryCast(e.OriginalSource, ContentPane)

    If e.Items.Count > 0 Then
        Dim sep As New Separator()
        sep.SetResourceReference(Separator.StyleProperty, XamDockManager.MenuItemSeparatorStyleKey)
        e.Items.Add(sep)
    End If

    ' the OptionsMenuOpening event is raised when you right click on a 
    ' pane's caption or tab item as well as when you click the window 
    ' position menu item in the caption and allows you to add/remove 
    ' items from the menu. 
    Dim mi As New MenuItem()
    mi.Command = ApplicationCommands.Save

    ' to have the menu items use the same styling as the default 
    ' menu items, we'll associate it with the same style that 
    ' the dockmanager uses for its menu items 
    mi.SetResourceReference(MenuItem.StyleProperty, XamDockManager.MenuItemStyleKey)

    e.Items.Add(mi)
End Sub

Private Sub CommandBinding_CanExecute(ByVal sender As Object, ByVal e As CanExecuteRoutedEventArgs)
    ' for the purposes of this demonstration, the save command 
    ' associated with the binding that raises this event is always 
    ' enabled 
    e.CanExecute = True
    e.Handled = True
End Sub

Private Sub CommandBinding_Executed(ByVal sender As Object, ByVal e As ExecutedRoutedEventArgs)
    ' implement save functionality here 
    Dim dlg As New Microsoft.Win32.SaveFileDialog()
    dlg.ShowDialog()
End Sub
using Infragistics.Windows.DockManager;
using Infragistics.Windows.DockManager.Events;

private void ContentPane_OptionsMenuOpening(object sender, PaneOptionsMenuOpeningEventArgs e)
{
	ContentPane cp = e.OriginalSource as ContentPane;

	if (e.Items.Count > 0)
	{
		Separator sep = new Separator();
		sep.SetResourceReference(Separator.StyleProperty, XamDockManager.MenuItemSeparatorStyleKey);
		e.Items.Add(sep);
	}

	// the OptionsMenuOpening event is raised when you right click on a
	// pane's caption or tab item as well as when you click the window
	// position menu item in the caption and allows you to add/remove
	// items from the menu.
	MenuItem mi = new MenuItem();
	mi.Command = ApplicationCommands.Save;

	// to have the menu items use the same styling as the default
	// menu items, we'll associate it with the same style that
	// the dockmanager uses for its menu items
	mi.SetResourceReference(MenuItem.StyleProperty, XamDockManager.MenuItemStyleKey);

	e.Items.Add(mi);
} 

private void CommandBinding_CanExecute(object sender, CanExecuteRoutedEventArgs e)
{
	// for the purposes of this demonstration, the save command
	// associated with the binding that raises this event is always
	// enabled
	e.CanExecute = true;
	e.Handled = true;
}

private void CommandBinding_Executed(object sender, ExecutedRoutedEventArgs e)
{
	// implement save functionality here
	Microsoft.Win32.SaveFileDialog dlg = new Microsoft.Win32.SaveFileDialog();
	dlg.ShowDialog();
}
<igDock:XamDockManager>
    
<igDock:XamDockManager.Panes>
        
<igDock:SplitPane>
            
<igDock:ContentPane Header="Extra Options"
                                
OptionsMenuOpening="ContentPane_OptionsMenuOpening">
                
<!-- The code will add a Save menu item to the pane's
                     options menu so make sure the pane can indicate
                     if the command is enabled. 
-->
                
<igDock:ContentPane.CommandBindings>
                    
<CommandBinding Command="Save"
                                    
CanExecute="CommandBinding_CanExecute"
                                    
Executed="CommandBinding_Executed"/>
                
</igDock:ContentPane.CommandBindings>
            
</igDock:ContentPane>
        
</igDock:SplitPane>
    
</igDock:XamDockManager.Panes>
</igDock:XamDockManager>
Requirements

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

See Also