The event handler receives an argument of type BeforeTaskPaneToolSelectedEventArgs containing data related to this event. The following BeforeTaskPaneToolSelectedEventArgs properties provide information specific to this event.
The following example code demonstrates the SelectedTaskPaneTool and the associated events that are invoked on the UltraToolbarsManager.
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.UltraWinToolbars
Private Sub UltraButton3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles UltraButton3.Click
' UltraTaskPaneToolbar is a derived UltraToolbar so
' it must be cast to the derived type when retreived
' from the Toolbars collection of the component
Dim taskPane As UltraTaskPaneToolbar = CType(Me.UltraToolbarsManager1.Toolbars("TaskPaneDemo"), UltraTaskPaneToolbar)
' when the 'SelectedTaskPaneTool' property is set, the
' tool will be selected and its associated Control
' will be displayed in the content area of the task pane.
taskPane.SelectedTaskPaneTool = taskPane.Tools("dayview")
End Sub
Private Sub UltraToolbarsManager1_BeforeTaskPaneToolSelected(ByVal sender As Object, ByVal e As Infragistics.Win.UltraWinToolbars.BeforeTaskPaneToolSelectedEventArgs) Handles UltraToolbarsManager1.BeforeTaskPaneToolSelected
' The BeforeTaskPaneToolSelected is invoked immediately before
' the 'SelectedTaskPaneTool' property of an UltraTaskPaneToolbar
' has been changed. This event is cancellable and can be used to
' prevent the selected task pane from being changed.
If e.Tool.Key = "monthview" Then
e.Cancel = True
End If
End Sub
Private Sub UltraToolbarsManager1_AfterTaskPaneToolSelected(ByVal sender As Object, ByVal e As Infragistics.Win.UltraWinToolbars.TaskPaneToolbarEventArgs) Handles UltraToolbarsManager1.AfterTaskPaneToolSelected
' The AfterTaskPaneToolSelected event is invoked immediately after
' the 'SelectedTaskPaneTool' property of an UltraTaskPaneToolbar
' has been changed. This event can be used to initialize properties
' of a task pane tool or its associated control.
'
If Not e.TaskPaneToolbar.SelectedTaskPaneTool Is Nothing AndAlso Not e.TaskPaneToolbar.SelectedTaskPaneTool.Control Is Nothing Then
e.TaskPaneToolbar.SelectedTaskPaneTool.Control.Text = "Changed"
End If
End Sub
using Infragistics.Shared;
using Infragistics.Win;
using Infragistics.Win.UltraWinToolbars;
private void ultraButton3_Click(object sender, System.EventArgs e)
{
// UltraTaskPaneToolbar is a derived UltraToolbar so
// it must be cast to the derived type when retreived
// from the Toolbars collection of the component
UltraTaskPaneToolbar taskPane = this.ultraToolbarsManager1.Toolbars["TaskPaneDemo"] as UltraTaskPaneToolbar;
// when the 'SelectedTaskPaneTool' property is set, the
// tool will be selected and its associated Control
// will be displayed in the content area of the task pane.
taskPane.SelectedTaskPaneTool = taskPane.Tools["dayview"];
}
private void ultraToolbarsManager1_BeforeTaskPaneToolSelected(object sender, Infragistics.Win.UltraWinToolbars.BeforeTaskPaneToolSelectedEventArgs e)
{
// The BeforeTaskPaneToolSelected is invoked immediately before
// the 'SelectedTaskPaneTool' property of an UltraTaskPaneToolbar
// has been changed. This event is cancellable and can be used to
// prevent the selected task pane from being changed.
if (e.Tool.Key == "monthview")
e.Cancel = true;
}
private void ultraToolbarsManager1_AfterTaskPaneToolSelected(object sender, Infragistics.Win.UltraWinToolbars.TaskPaneToolbarEventArgs e)
{
// The AfterTaskPaneToolSelected event is invoked immediately after
// the 'SelectedTaskPaneTool' property of an UltraTaskPaneToolbar
// has been changed. This event can be used to initialize properties
// of a task pane tool or its associated control.
//
if (e.TaskPaneToolbar.SelectedTaskPaneTool != null && e.TaskPaneToolbar.SelectedTaskPaneTool.Control != null)
e.TaskPaneToolbar.SelectedTaskPaneTool.Control.Text = "Changed";
}
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