Version

BeforePaneButtonClick Event

Occurs before the action associated with a PaneButton is executed.
Syntax
'Declaration
 
Public Event BeforePaneButtonClick As CancelablePaneButtonEventHandler
public event CancelablePaneButtonEventHandler BeforePaneButtonClick
Event Data

The event handler receives an argument of type CancelablePaneButtonEventArgs containing data related to this event. The following CancelablePaneButtonEventArgs properties provide information specific to this event.

PropertyDescription
Button Returns the PaneButton associated with the event.
Cancel (Inherited from System.ComponentModel.CancelEventArgs) 
Pane Returns the pane associated with the event.
Example
The following code demonstrates how to selectively prevent the action associated with clicking a pane button from occuring.

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.Shared
Imports Infragistics.Win
Imports Infragistics.Win.UltraWinDock

Private Sub ultraDockManager1_BeforePaneButtonClick(ByVal sender As Object, ByVal e As Infragistics.Win.UltraWinDock.CancelablePaneButtonEventArgs) Handles ultraDockManager1.BeforePaneButtonClick

    ' The BeforePaneButtonClick event is invoked when the
    ' user clicks a pane caption button but before the 
    ' associated action is invoked. The Button parameter
    ' of the event args indicates the button that was clicked.
    ' The associated action may be prevented by setting the
    ' Cancel parameter to false.
    '

    ' You can prevent a pane button's action from being invoked
    ' by setting the cancel parameter to true.
    '
    If (e.Button = PaneButton.Close) Then

        Dim dr As DialogResult = MessageBox.Show(Me, _
            "Are you sure you want to close this pane?", _
            Application.ProductName, _
            MessageBoxButtons.YesNo, _
            MessageBoxIcon.Question)

        If (dr = DialogResult.No) Then
            e.Cancel = True
        End If
    End If

End Sub
using Infragistics.Shared;
using Infragistics.Win;
using Infragistics.Win.UltraWinDock;
using System.Diagnostics;

private void ultraDockManager1_BeforePaneButtonClick(object sender, Infragistics.Win.UltraWinDock.CancelablePaneButtonEventArgs e)
{

	// The BeforePaneButtonClick event is invoked when the
	// user clicks a pane caption button but before the 
	// associated action is invoked. The Button parameter
	// of the event args indicates the button that was clicked.
	// The associated action may be prevented by setting the
	// Cancel parameter to false.
	//

	// You can prevent a pane button's action from being invoked
	// by setting the cancel parameter to true.
	//
	if (e.Button == PaneButton.Close)
	{
		DialogResult dr = MessageBox.Show(this,
			"Are you sure you want to close this pane?", 
			Application.ProductName,
			MessageBoxButtons.YesNo,
			MessageBoxIcon.Question);

		if (dr == DialogResult.No)
			e.Cancel = true;
	}

}
Requirements

Target Platforms: Windows 10, Windows 8.1, Windows 8, Windows 7, Windows Server 2012, Windows 7, 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