'Declaration Public ReadOnly Property SharedProps As SharedProps
public SharedProps SharedProps {get;}
UltraWinToolbars represents a tool in two ways, as a root tool and an instance tool. Root tools are the tools that appear in the run-time customizer; their purpose is to create the tools that will appear on a toolbar or menu. Instance tools are the tools that the user actually interacts with; they appear on toolbars and/or menus. Each instance tool is related to exactly one root tool. Each root tool may have multiple instance tools derived from it. For example, a "FileSave" root tool may have two instance tools in an application - one displaying only text and appearing on the File menu, and one displaying only an image and appearing on the Standard toolbar.
Although functionally treated as distinct objects, root and instance tools share a close relationship. Changes made to a root tool will affect all instance tools derived from that root. Changes to an instance tool may affect only the one instance, or they may affect the root tool and by extension other instances of that root.
Because root and instance tools have some features that are shared and some that are unique, UltraWinToolbars splits some of each tool's properties between two objects. Properties that apply to the root tool and all instances of that tool are found on the SharedProps object, which is accessed via the tool's SharedProps property. As the name suggests, the properties of the SharedProps object are shared across all instances of the tool. A change to one of these properties will affect the root tool and all other instances of the tool.
Properties that affect only a single instance of the tool are found on the InstanceProps object, which is accessed via the tool's InstanceProps property. Although root tools have an InstanceProps property, this property returns Null, as there are no instance properties associated with a root tool.
These properties exist in an inheritance hierarchy, with common properties supporting a "use default" setting to indicate that the value of that property should be inherited. When resolving the property setting for a particular tool instance, the InstanceProps value for a property is applied first. If the InstanceProps property is set to its "use default" value (i.e. there is not InstanceProps value for the property) then the SharedProps setting for the property is used. The default values of the SharedProps object always provide a value that can be used by the control. If for some reason the SharedProps value is set to "use default", the intrinsic value of the root tool is used.
For a complete discussion of the difference between root and instance tools, see the following section of the help: Developer’s Guide > The Toolset > Controls and Components > WinToolbarsManager > Understanding WinToolbarsManager.
Imports System.Diagnostics Imports Infragistics.Win Imports Infragistics.Win.UltraWinToolbars Private Sub UltraToolbarsManager1_ToolClick(ByVal sender As Object, ByVal e As Infragistics.Win.UltraWinToolbars.ToolClickEventArgs) Handles UltraToolbarsManager1.ToolClick Debug.WriteLine("The Tool with key '" + e.Tool.Key + "' has been clicked. It is of type: '" + e.Tool.GetType().ToString() + "'") ' Display property information for the tool that was clicked. Debug.IndentLevel += 1 ' Display all the properties of the tool's SharedProps object. Debug.WriteLine("SharedProps properties ------------------------------------------") ' SharedProps.AllowMultipleInstances If e.Tool.SharedProps.AllowMultipleInstances = False Then Debug.WriteLine("Only one instance of this tool may be created!") End If Debug.WriteLine("Caption: '" + e.Tool.SharedProps.Caption) Debug.WriteLine("Tool has been assigned to category: '" + e.Tool.SharedProps.Category) Debug.WriteLine("The description that will be displayed for this tool in the runtime customizer is: '" + e.Tool.SharedProps.CustomizerCaption) Debug.WriteLine("DisplayStyle: '" + e.Tool.SharedProps.DisplayStyle.ToString()) Debug.WriteLine("The enabled status for this tool is: '" + e.Tool.SharedProps.Enabled.ToString()) Debug.WriteLine("MaxWidth: '" + e.Tool.SharedProps.MaxWidth.ToString()) Debug.WriteLine("MinWidth: '" + e.Tool.SharedProps.MinWidth.ToString()) Debug.WriteLine("The MergeOrder for this tool is: '" + e.Tool.SharedProps.MergeOrder.ToString()) Debug.WriteLine("The MergeType for this tool is: '" + e.Tool.SharedProps.MergeType.ToString()) Debug.WriteLine("The Priority for this tool when determining if it can be displayed on a toolbar with limited space is: '" + e.Tool.SharedProps.Priority.ToString()) Debug.WriteLine("The Shortcut key combination associated with this tool is: '" + e.Tool.SharedProps.Shortcut.ToString()) Debug.WriteLine("Spring: '" + e.Tool.SharedProps.Spring.ToString()) Debug.WriteLine("Total # of instances of this tool: '" + e.Tool.SharedProps.ToolInstances.Count.ToString()) Debug.WriteLine("ToolTipText: '" + e.Tool.SharedProps.ToolTipText.ToString()) Debug.WriteLine("Visible: '" + e.Tool.SharedProps.Visible.ToString()) Debug.WriteLine("Width: '" + e.Tool.SharedProps.Width.ToString()) If e.Tool.SharedProps.ShowInCustomizer = False Then Debug.WriteLine("This tool will NOT be shown in the runtime customizer.") End If Debug.IndentLevel -= 1 End Sub
using System.Diagnostics; using Infragistics.Win; using Infragistics.Win.UltraWinToolbars; private void ultraToolbarsManager1_ToolClick(object sender, Infragistics.Win.UltraWinToolbars.ToolClickEventArgs e) { Debug.WriteLine("The Tool with key '" + e.Tool.Key + "' has been clicked. It is of type: '" + e.Tool.GetType().ToString() + "'"); // Display property information for the tool that was clicked. Debug.IndentLevel++; // Display all the properties of the tool's SharedProps object. Debug.WriteLine("SharedProps properties ------------------------------------------"); // SharedProps.AllowMultipleInstances if (e.Tool.SharedProps.AllowMultipleInstances == false) Debug.WriteLine("Only one instance of this tool may be created!"); Debug.WriteLine("Caption: '" + e.Tool.SharedProps.Caption); Debug.WriteLine("Tool has been assigned to category: '" + e.Tool.SharedProps.Category); Debug.WriteLine("The description that will be displayed for this tool in the runtime customizer is: '" + e.Tool.SharedProps.CustomizerCaption); Debug.WriteLine("DisplayStyle: '" + e.Tool.SharedProps.DisplayStyle.ToString()); Debug.WriteLine("The enabled status for this tool is: '" + e.Tool.SharedProps.Enabled.ToString()); Debug.WriteLine("MaxWidth: '" + e.Tool.SharedProps.MaxWidth.ToString()); Debug.WriteLine("MinWidth: '" + e.Tool.SharedProps.MinWidth.ToString()); Debug.WriteLine("The MergeOrder for this tool is: '" + e.Tool.SharedProps.MergeOrder.ToString()); Debug.WriteLine("The MergeType for this tool is: '" + e.Tool.SharedProps.MergeType.ToString()); Debug.WriteLine("The Priority for this tool when determining if it can be displayed on a toolbar with limited space is: '" + e.Tool.SharedProps.Priority.ToString()); Debug.WriteLine("The Shortcut key combination associated with this tool is: '" + e.Tool.SharedProps.Shortcut.ToString()); Debug.WriteLine("Spring: '" + e.Tool.SharedProps.Spring.ToString()); Debug.WriteLine("Total # of instances of this tool: '" + e.Tool.SharedProps.ToolInstances.Count.ToString()); Debug.WriteLine("ToolTipText: '" + e.Tool.SharedProps.ToolTipText.ToString()); Debug.WriteLine("Visible: '" + e.Tool.SharedProps.Visible.ToString()); Debug.WriteLine("Width: '" + e.Tool.SharedProps.Width.ToString()); if (e.Tool.SharedProps.ShowInCustomizer == false) Debug.WriteLine("This tool will NOT be shown in the runtime customizer."); 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