Version

CloseActionProperty Field

Identifies the CloseAction dependency property
Syntax
'Declaration
 
Public Shared ReadOnly CloseActionProperty As DependencyProperty
public static readonly DependencyProperty CloseActionProperty
Example
This example demonstrates using some of the close/hide related members of the ContentPane class.

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_Closing(ByVal sender As Object, ByVal e As PaneClosingEventArgs)
    Dim result As MessageBoxResult = MessageBox.Show(Me, "Can this pane be hidden?", "Close Pane", MessageBoxButton.YesNo, MessageBoxImage.Question)

    If MessageBoxResult.No = result Then
        e.Cancel = True
    End If
End Sub

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

    System.Diagnostics.Debug.WriteLine(cp.Header, "Closed")
End Sub

Private Sub InitializeDmClosePane(ByVal dockManager As XamDockManager)
    Dim split As New SplitPane()

    ' By default when a pane is closed, it 
    ' is just hidden. For some panes though 
    ' you may just want the pane to be removed. 
    ' The CloseAction can be used to control this. 
    Dim cpRemove As New ContentPane()
    cpRemove.CloseAction = PaneCloseAction.RemovePane
    cpRemove.Header = "Remove When Closed"
    split.Panes.Add(cpRemove)

    ' You can prevent a pane from being closed using 
    ' the AllowClose property. By default all panes 
    ' can be closed and when closed the Visibility 
    ' is changed to Collapsed. 
    Dim cpNever As New ContentPane()
    cpNever.AllowClose = False
    cpNever.Header = "Never Close"
    split.Panes.Add(cpNever)

    ' You can handle the Closing event to conditionally 
    ' prevent the pane from being closed. The Closed 
    ' event is fired after the pane has been closed 
    ' regardless of the CloseAction 
    Dim cpConditional As New ContentPane()
    cpConditional.Header = "Conditionally Close"
    AddHandler cpConditional.Closing, AddressOf Me.ContentPane_Closing
    AddHandler cpConditional.Closed, AddressOf Me.ContentPane_Closed
    split.Panes.Add(cpConditional)

    dockManager.Panes.Add(split)
End Sub
using Infragistics.Windows.DockManager;
using Infragistics.Windows.DockManager.Events;

private void ContentPane_Closing(object sender, PaneClosingEventArgs e)
{
	MessageBoxResult result = MessageBox.Show(this, "Can this pane be hidden?", 
		"Close Pane", MessageBoxButton.YesNo, MessageBoxImage.Question);

	if (MessageBoxResult.No == result)
	{
		e.Cancel = true;
	}
}

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

	System.Diagnostics.Debug.WriteLine(cp.Header, "Closed");
} 

private void InitializeDmClosePane(XamDockManager dockManager)
{
	SplitPane split = new SplitPane();

	// By default when a pane is closed, it 
	// is just hidden. For some panes though
	// you may just want the pane to be removed. 
	// The CloseAction can be used to control this.
	ContentPane cpRemove = new ContentPane();
	cpRemove.CloseAction = PaneCloseAction.RemovePane;
	cpRemove.Header = "Remove When Closed";
	split.Panes.Add(cpRemove);

	// You can prevent a pane from being closed using
	// the AllowClose property. By default all panes
	// can be closed and when closed the Visibility
	// is changed to Collapsed.
	ContentPane cpNever = new ContentPane();
	cpNever.AllowClose = false;
	cpNever.Header = "Never Close";
	split.Panes.Add(cpNever);
	
	// You can handle the Closing event to conditionally 
	// prevent the pane from being closed. The Closed 
	// event is fired after the pane has been closed 
	// regardless of the CloseAction
	ContentPane cpConditional = new ContentPane();
	cpConditional.Header = "Conditionally Close";
	cpConditional.Closing += new EventHandler<PaneClosingEventArgs>(this.ContentPane_Closing);
	cpConditional.Closed += new EventHandler<PaneClosedEventArgs>(this.ContentPane_Closed);
	split.Panes.Add(cpConditional);

	dockManager.Panes.Add(split);
}
<igDock:XamDockManager>
    
<igDock:XamDockManager.Panes>
        
<igDock:SplitPane>
            
<!-- By default when a pane is closed, it 
                 is just hidden. For some panes though
                 you may just want the pane to be removed. 
                 The CloseAction can be used to control this.
            
-->
            
<igDock:ContentPane Header="Remove When Closed"
                                
CloseAction="RemovePane"/>

            
<!-- You can prevent a pane from being closed using
                 the AllowClose property. By default all panes
                 can be closed and when closed the Visibility
                 is changed to Collapsed. 
-->
            
<igDock:ContentPane Header="Never Close"
                                
AllowClose="False"/>
            
            
<!-- You can handle the Closing event to conditionally 
                 prevent the pane from being closed. The Closed 
                 event is fired after the pane has been closed 
                 regardless of the CloseAction. 
-->
            
<igDock:ContentPane Header="Conditionally Close"
                                
Closing="ContentPane_Closing"
                                
Closed="ContentPane_Closed"/>
        
</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