'Declaration Public Property SelectedTool As StateButtonTool
public StateButtonTool SelectedTool {get; set;}
This property is used to specify or return the selected StateButtonTool in the OptionSet.
When the AllowAllUp property is set to False, one StateButtonTool must be selected at any given time.
Imports System.Diagnostics Imports Infragistics.Win Imports Infragistics.Win.UltraWinToolbars Private Sub Button21_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button21.Click Debug.WriteLine("Tool property values") Debug.IndentLevel += 1 Dim toolbar As UltraToolbar For Each toolbar In Me.UltraToolbarsManager1.Toolbars Debug.WriteLine("Toolbar '" + toolbar.Key + "' tool info -----------------------") Debug.IndentLevel += 1 Me.ProcessToolsCollection(toolbar.Tools) Debug.IndentLevel -= 1 Next Debug.IndentLevel -= 1 End Sub Private Sub ProcessToolsCollection(ByVal tools As ToolsCollection) Dim tool As ToolBase For Each tool In tools Debug.IndentLevel += 1 ' Display properties common to all tools (inherited from ToolBase). Debug.WriteLine("Tool #" + tool.Index.ToString() + " (Key: " + tool.Key + ") is a " + tool.GetType().Name.ToString()) Debug.IndentLevel += 1 ' Display properties specific to each tool type. If TypeOf (tool) Is ComboBoxTool Then Dim comboBoxTool As ComboBoxTool = tool If Not comboBoxTool.SelectedItem Is Nothing Then Debug.WriteLine("Its SelectedItem is of type: " + comboBoxTool.SelectedItem.ToString()) End If End If If TypeOf (tool) Is ControlContainerTool Then Dim controlContainerTool As ControlContainerTool = tool If controlContainerTool.CanSetWidth = True Then Debug.WriteLine("Its width CAN be set.") Else Debug.WriteLine("Its width CANNOT be set.") End If Debug.WriteLine("Its VerticalDisplayStyle is: " + controlContainerTool.VerticalDisplayStyle.ToString()) End If If TypeOf (tool) Is FontListTool Then Dim fontListTool As FontListTool = tool Dim mruItems As String = "" Dim mruItem As String For Each mruItem In fontListTool.MruItems mruItems += "[" + mruItem + "] " Next Debug.WriteLine("Its MruItems collection contains the following items: " + mruItems) End If If TypeOf (tool) Is ListTool Then Dim listTool As ListTool = tool If Not listTool.SelectedItem Is Nothing Then Debug.WriteLine("Its SelectedItem is of type: " + listTool.SelectedItem.ToString()) End If Debug.WriteLine("Its SelectedItemIndex is: " + listTool.SelectedItemIndex.ToString()) End If If TypeOf (tool) Is MdiWindowListTool Then Dim mdiWindowListTool As MdiWindowListTool = tool If Not mdiWindowListTool.MdiContainerForm Is Nothing Then Debug.WriteLine("Its Mdi container form's name is: " + mdiWindowListTool.MdiContainerForm.Name) End If Debug.WriteLine("Its SelectedItemIndex is: " + mdiWindowListTool.SelectedItemIndex.ToString()) End If If TypeOf (tool) Is PopupColorPickerTool Then Dim popupColorPickerTool As PopupColorPickerTool = tool Debug.WriteLine("Its selected color is: " + popupColorPickerTool.SelectedColor.ToString()) Debug.WriteLine("Its replaceable color is: " + popupColorPickerTool.ReplaceableColor.ToString()) End If If TypeOf (tool) Is PopupMenuTool Then Dim popupMenuTool As PopupMenuTool = tool Debug.WriteLine("Its DropdownArrowStyle is: " + popupMenuTool.DropDownArrowStyle.ToString()) Debug.WriteLine("Its DropdownArrowStyleResolved is: " + popupMenuTool.DropDownArrowStyleResolved.ToString()) If popupMenuTool.IsOpen = True Then Debug.WriteLine("It is currently OPEN") Else Debug.WriteLine("It is currently NOT open") End If Debug.IndentLevel += 1 Debug.WriteLine("It contains the following tools: ") ' Call this routine recursively to process each tool on the menu. Me.ProcessToolsCollection(popupMenuTool.Tools) Debug.IndentLevel -= 1 End If If TypeOf (tool) Is StateButtonTool Then Dim stateButtonTool As StateButtonTool = tool If Not stateButtonTool.OptionSet Is Nothing Then Debug.WriteLine("It does not have an associated OptionSet!") Else Debug.WriteLine("Its associated OptionSet's Key is: " + stateButtonTool.OptionSetKey) Debug.WriteLine("Its associated OptionSet's AllowAllUp property is: " + stateButtonTool.OptionSet.AllowAllUp.ToString()) Debug.WriteLine("Its associated OptionSet's currently selected tool key is: " + stateButtonTool.OptionSet.SelectedTool.Key) Dim otherKeys As String = "" Dim optionSetTool As ToolBase For Each optionSetTool In stateButtonTool.OptionSet.Tools If optionSetTool.Key <> stateButtonTool.Key Then otherKeys += "[" + optionSetTool.Key + "] " End If Next Debug.WriteLine("Its associated OptionSet also contains tools with the following keys: " + otherKeys) End If End If If TypeOf (tool) Is TextBoxTool Then Dim textBoxTool As TextBoxTool = tool If textBoxTool.IsInEditMode = True Then Debug.WriteLine("It IS in edit mode") Debug.WriteLine("Its SelectedText is: '" + textBoxTool.SelectedText) Debug.WriteLine("Its text selection starts at position: '" + textBoxTool.SelectionStart.ToString()) Debug.WriteLine("Its text selection is of length: '" + textBoxTool.SelectionLength.ToString()) Else Debug.WriteLine("It is NOT in edit mode") End If End If Debug.IndentLevel -= 1 Debug.IndentLevel -= 1 Next End Sub
using System.Diagnostics; using Infragistics.Win; using Infragistics.Win.UltraWinToolbars; private void button21_Click(object sender, System.EventArgs e) { Debug.WriteLine("Tool property values"); Debug.IndentLevel++; foreach(UltraToolbar toolbar in this.ultraToolbarsManager1.Toolbars) { Debug.WriteLine("Toolbar '" + toolbar.Key + "' tool info -----------------------"); Debug.IndentLevel++; this.ProcessToolsCollection(toolbar.Tools); Debug.IndentLevel--; } Debug.IndentLevel--; } private void ProcessToolsCollection(ToolsCollection tools) { foreach(ToolBase tool in tools) { Debug.IndentLevel++; // Display properties common to all tools (inherited from ToolBase). Debug.WriteLine("Tool #" + tool.Index.ToString() + " (Key: " + tool.Key + ") is a " + tool.GetType().Name.ToString()); Debug.IndentLevel++; // Display properties specific to each tool type. if (tool is ComboBoxTool) { ComboBoxTool comboBoxTool = tool as ComboBoxTool; if (comboBoxTool.SelectedItem != null) Debug.WriteLine("Its SelectedItem is of type: " + comboBoxTool.SelectedItem.ToString()); } if (tool is ControlContainerTool) { ControlContainerTool controlContainerTool = tool as ControlContainerTool; if (controlContainerTool.CanSetWidth == true) Debug.WriteLine("Its width CAN be set."); else Debug.WriteLine("Its width CANNOT be set."); Debug.WriteLine("Its VerticalDisplayStyle is: " + controlContainerTool.VerticalDisplayStyle.ToString()); } if (tool is FontListTool) { FontListTool fontListTool = tool as FontListTool; string mruItems = ""; foreach(string mruItem in fontListTool.MruItems) { mruItems += "[" + mruItem + "] "; } Debug.WriteLine("Its MruItems collection contains the following items: " + mruItems); } if (tool is ListTool) { ListTool listTool = tool as ListTool; if (listTool.SelectedItem != null) Debug.WriteLine("Its SelectedItem is of type: " + listTool.SelectedItem.ToString()); Debug.WriteLine("Its SelectedItemIndex is: " + listTool.SelectedItemIndex.ToString()); } if (tool is MdiWindowListTool) { MdiWindowListTool mdiWindowListTool = tool as MdiWindowListTool; if (mdiWindowListTool.MdiContainerForm != null) Debug.WriteLine("Its Mdi container form's name is: " + mdiWindowListTool.MdiContainerForm.Name); Debug.WriteLine("Its SelectedItemIndex is: " + mdiWindowListTool.SelectedItemIndex.ToString()); } if (tool is PopupColorPickerTool) { PopupColorPickerTool popupColorPickerTool = tool as PopupColorPickerTool; Debug.WriteLine("Its selected color is: " + popupColorPickerTool.SelectedColor.ToString()); Debug.WriteLine("Its replaceable color is: " + popupColorPickerTool.ReplaceableColor.ToString()); } if (tool is PopupMenuTool) { PopupMenuTool popupMenuTool = tool as PopupMenuTool; Debug.WriteLine("Its DropdownArrowStyle is: " + popupMenuTool.DropDownArrowStyle.ToString()); Debug.WriteLine("Its DropdownArrowStyleResolved is: " + popupMenuTool.DropDownArrowStyleResolved.ToString()); if (popupMenuTool.IsOpen == true) Debug.WriteLine("It is currently OPEN"); else Debug.WriteLine("It is currently NOT open"); Debug.IndentLevel++; Debug.WriteLine("It contains the following tools: " ); // Call this routine recursively to process each tool on the menu. this.ProcessToolsCollection(popupMenuTool.Tools); Debug.IndentLevel--; } if (tool is StateButtonTool) { StateButtonTool stateButtonTool = tool as StateButtonTool; if (stateButtonTool.OptionSet == null) Debug.WriteLine("It does not have an associated OptionSet!"); else { Debug.WriteLine("Its associated OptionSet's Key is: " + stateButtonTool.OptionSetKey); Debug.WriteLine("Its associated OptionSet's AllowAllUp property is: " + stateButtonTool.OptionSet.AllowAllUp.ToString()); Debug.WriteLine("Its associated OptionSet's currently selected tool key is: " + stateButtonTool.OptionSet.SelectedTool.Key); string otherKeys = ""; foreach(ToolBase optionSetTool in stateButtonTool.OptionSet.Tools) { if (optionSetTool.Key != stateButtonTool.Key) otherKeys += "[" + optionSetTool.Key + "] "; } Debug.WriteLine("Its associated OptionSet also contains tools with the following keys: " + otherKeys); } } if (tool is TextBoxTool) { TextBoxTool textBoxTool = tool as TextBoxTool; if (textBoxTool.IsInEditMode == true) { Debug.WriteLine("It IS in edit mode"); Debug.WriteLine("Its SelectedText is: '" + textBoxTool.SelectedText); Debug.WriteLine("Its text selection starts at position: '" + textBoxTool.SelectionStart.ToString()); Debug.WriteLine("Its text selection is of length: '" + textBoxTool.SelectionLength.ToString()); } else Debug.WriteLine("It is NOT in edit mode"); } Debug.IndentLevel--; Debug.IndentLevel--; } }
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