バージョン

ToolWindowUnloaded イベント

PaneToolWindowXamDockManager から削除される時に発生します
シンタックス
'宣言
 
Public Event ToolWindowUnloaded As EventHandler(Of PaneToolWindowEventArgs)
public event EventHandler<PaneToolWindowEventArgs> ToolWindowUnloaded
イベント データ

イベント ハンドラが、このイベントに関連するデータを含む、PaneToolWindowEventArgs 型の引数を受け取りました。次の PaneToolWindowEventArgs プロパティには、このイベントの固有の情報が記載されます。

プロパティ解説
Handled System.Windows.RoutedEventArgsから継承されます。Gets or sets a value that indicates the present state of the event handling for a routed event as it travels the route.
OriginalSource System.Windows.RoutedEventArgsから継承されます。Gets the original reporting source as determined by pure hit testing, before any possible System.Windows.RoutedEventArgs.Source adjustment by a parent class.
RoutedEvent System.Windows.RoutedEventArgsから継承されます。Gets or sets the System.Windows.RoutedEventArgs.RoutedEvent associated with this System.Windows.RoutedEventArgs instance.
Source System.Windows.RoutedEventArgsから継承されます。Gets or sets a reference to the object that raised the event.
Window イベントに関連付けられた Infragistics.Windows.DockManager.PaneToolWindow を返します。
解説

すべてのペインが PaneToolWindow から削除されており、ウィンドウが XamDockManager から削除されようとする時に、イベントは発生します。ツール ウィンドウが含まれているすべてのペインが非表示になっているので、ツール ウィンドウも非表示であるというだけで、これは発生しません。

使用例
Imports Infragistics.Windows.DockManager
Imports Infragistics.Windows.DockManager.Events

Private Sub InitializeDmWithLoadEvents(ByVal dockManager As XamDockManager)
    ' the OptionsMenuOpening event is a bubble event so we'll 
    ' handle it on the dockmanager. however, since panes in 
    ' floating windows are in top level wpf windows, the events 
    ' will not bubble to the dockmanager so we will use the 
    ' ToolWindowLoaded event to hook the event on the toolwindow 
    ' as well. 
    dockManager.AddHandler(ContentPane.OptionsMenuOpeningEvent, New EventHandler(Of PaneOptionsMenuOpeningEventArgs)(AddressOf Me.XamDockManager_OptionsMenuOpening))

    AddHandler dockManager.ToolWindowLoaded, AddressOf Me.XamDockManager_ToolWindowLoaded
    AddHandler dockManager.ToolWindowUnloaded, AddressOf Me.XamDockManager_ToolWindowUnloaded
End Sub

Private Sub XamDockManager_ToolWindowLoaded(ByVal sender As Object, ByVal e As PaneToolWindowEventArgs)
    ' the toolwindows are top level windows (at least when running in a window 
    ' application) so events will not route to the dockmanager. we can use 
    ' this event to hook such events or add elements into the resources chain 
    ' 
    e.Window.AddHandler(ContentPane.OptionsMenuOpeningEvent, New EventHandler(Of PaneOptionsMenuOpeningEventArgs)(AddressOf Me.XamDockManager_OptionsMenuOpening))
End Sub

Private Sub XamDockManager_ToolWindowUnloaded(ByVal sender As Object, ByVal e As PaneToolWindowEventArgs)
    ' unhook the event we hooked in the Loaded event 
    e.Window.RemoveHandler(ContentPane.OptionsMenuOpeningEvent, New EventHandler(Of PaneOptionsMenuOpeningEventArgs)(AddressOf Me.XamDockManager_OptionsMenuOpening))
End Sub

Private Sub XamDockManager_OptionsMenuOpening(ByVal sender As Object, ByVal e As PaneOptionsMenuOpeningEventArgs)
    ' 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
using Infragistics.Windows.DockManager;
using Infragistics.Windows.DockManager.Events;

private void InitializeDmWithLoadEvents(XamDockManager dockManager)
{
	// the OptionsMenuOpening event is a bubble event so we'll
	// handle it on the dockmanager. however, since panes in 
	// floating windows are in top level wpf windows, the events
	// will not bubble to the dockmanager so we will use the
	// ToolWindowLoaded event to hook the event on the toolwindow
	// as well.
	dockManager.AddHandler(ContentPane.OptionsMenuOpeningEvent, new EventHandler<PaneOptionsMenuOpeningEventArgs>(this.XamDockManager_OptionsMenuOpening));

	dockManager.ToolWindowLoaded += new EventHandler<PaneToolWindowEventArgs>(this.XamDockManager_ToolWindowLoaded);
	dockManager.ToolWindowUnloaded += new EventHandler<PaneToolWindowEventArgs>(this.XamDockManager_ToolWindowUnloaded);
}

private void XamDockManager_ToolWindowLoaded(object sender, PaneToolWindowEventArgs e)
{
	// the toolwindows are top level windows (at least when running in a window 
	// application) so events will not route to the dockmanager. we can use
	// this event to hook such events or add elements into the resources chain
	//
	e.Window.AddHandler(ContentPane.OptionsMenuOpeningEvent,
		new EventHandler<PaneOptionsMenuOpeningEventArgs>(this.XamDockManager_OptionsMenuOpening));
}

private void XamDockManager_ToolWindowUnloaded(object sender, PaneToolWindowEventArgs e)
{
	// unhook the event we hooked in the Loaded event
	e.Window.RemoveHandler(ContentPane.OptionsMenuOpeningEvent,
		new EventHandler<PaneOptionsMenuOpeningEventArgs>(this.XamDockManager_OptionsMenuOpening));
}

private void XamDockManager_OptionsMenuOpening(object sender, PaneOptionsMenuOpeningEventArgs e)
{
	// 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);
}
参照