'Declaration Public Property AutoActivateControl As Infragistics.Win.DefaultableBoolean
public Infragistics.Win.DefaultableBoolean AutoActivateControl {get; set;}
Imports Infragistics.Shared Imports Infragistics.Win Imports Infragistics.Win.UltraWinToolbars Private Sub UltraButton1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles UltraButton1.Click ' create a new task pane toolbar Dim taskPaneToolbar As New UltraTaskPaneToolbar("TaskPane") Me.UltraToolbarsManager1.Toolbars.Add(taskPaneToolbar) ' creates some task pane tools Dim taskPaneTool As New TaskPaneTool("Button") Dim taskPaneTool2 As New TaskPaneTool("RichText") ' add the tool to the manager and then create an instance ' on the toolbar Me.UltraToolbarsManager1.Tools.Add(taskPaneTool) Me.UltraToolbarsManager1.Tools.Add(taskPaneTool2) taskPaneToolbar.Tools.AddTool("Button") taskPaneToolbar.Tools.AddTool("RichText") ' the HeaderCaption is displayed in the header area of the ' taskpane toolbar when this tool is selected taskPaneTool.HeaderCaption = "Button" ' the Caption is displayed in the menu of the task pane ' toolbar and is also used as the default header caption taskPaneTool.SharedProps.Caption = "Button Menu Caption" ' the following determines whether the control should receive ' focus when the tool is selected taskPaneTool.AutoActivateControl = True ' create a control to host in the task pane toolbar when ' the tool is selected Dim btn As New Button() btn.Visible = False ' hide it by default btn.Text = "Press" Me.Controls.Add(btn) taskPaneTool.Control = btn taskPaneTool2.SharedProps.Caption = "RichTextBox" Dim rtb As New RichTextBox() rtb.Visible = False ' hide it by default AddHandler rtb.TextChanged, AddressOf Me.OnRichTextChanged Me.Controls.Add(rtb) taskPaneTool2.Control = rtb End Sub Private Sub OnRichTextChanged(ByVal sender As Object, ByVal e As EventArgs) Dim rtb As RichTextBox = CType(sender, RichTextBox) Dim tool As TaskPaneTool = CType(Me.UltraToolbarsManager1.GetToolThatContainsControl(rtb), TaskPaneTool) If Not (tool Is Nothing) Then tool.HeaderCaption = "RichTextBox - " & rtb.TextLength End If End Sub 'OnRichTextChanged
using Infragistics.Shared; using Infragistics.Win; using Infragistics.Win.UltraWinToolbars; private void ultraButton1_Click(object sender, System.EventArgs e) { // create a new task pane toolbar UltraTaskPaneToolbar taskPaneToolbar = new UltraTaskPaneToolbar("TaskPane"); this.ultraToolbarsManager1.Toolbars.Add(taskPaneToolbar); // creates some task pane tools TaskPaneTool taskPaneTool = new TaskPaneTool("Button"); TaskPaneTool taskPaneTool2 = new TaskPaneTool("RichText"); // add the tool to the manager and then create an instance // on the toolbar this.ultraToolbarsManager1.Tools.Add(taskPaneTool); this.ultraToolbarsManager1.Tools.Add(taskPaneTool2); taskPaneToolbar.Tools.AddTool("Button"); taskPaneToolbar.Tools.AddTool("RichText"); // the HeaderCaption is displayed in the header area of the // taskpane toolbar when this tool is selected taskPaneTool.HeaderCaption = "Button"; // the Caption is displayed in the menu of the task pane // toolbar and is also used as the default header caption taskPaneTool.SharedProps.Caption = "Button Menu Caption"; // the following determines whether the control should receive // focus when the tool is selected taskPaneTool.AutoActivateControl = true; // create a control to host in the task pane toolbar when // the tool is selected Button btn = new Button(); btn.Visible = false; // hide it by default btn.Text = "Press"; this.Controls.Add(btn); taskPaneTool.Control = btn; taskPaneTool2.SharedProps.Caption = "RichTextBox"; RichTextBox rtb = new RichTextBox(); rtb.Visible = false; // hide it by default rtb.TextChanged += new EventHandler(this.OnRichTextChanged); this.Controls.Add(rtb); taskPaneTool2.Control = rtb; } private void OnRichTextChanged(object sender, EventArgs e) { RichTextBox rtb = sender as RichTextBox; TaskPaneTool tool = this.ultraToolbarsManager1.GetToolThatContainsControl(rtb) as TaskPaneTool; if (tool != null) tool.HeaderCaption = "RichTextBox - " + rtb.TextLength; }
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