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