Version

DisplayStyle Property (ToolPropsBase)

Gets or sets the display style for either all tools or a specific instance.
Syntax
'Declaration
 
Public Property DisplayStyle As ToolDisplayStyle
public ToolDisplayStyle DisplayStyle {get; set;}

Property Value

The display style for either all tools or a specific instance.
Exceptions
ExceptionDescription
System.NotSupportedExceptionThe property is modified at design-time for a tool in an UltraToolbarsManager defined on a base Form or UserControl. Inherited tools must be modified at run-time or at design-time through the designer of the Form or UserControl they were created on.
System.ComponentModel.InvalidEnumArgumentExceptionThe value assigned is not defined in the ToolDisplayStyle enumeration.
Remarks

When set for the SharedProps object, this property specifies the display style for all instances of a tool that have not had their display style explicitly set. When set for the InstanceProps object, this property specifies the display style for one instance of a tool.

The display style of a specific tool instance can be changed by the user during customization. The ToolBase.DisplayStyleResolved property is used to resolve the display style of a tool.

Note: This value does not affect tools that are placed on a RibbonGroup. The contents of a tool on a ribbon group are based upon the InstanceProps.PreferredSizeOnRibbon and InstanceProps.MinimumSizeOnRibbon.

Example
The following code creates 2 toolbars and a button tool. It adds an instance of the button tool to each toolbar. It then sets some shared properties on the tool which will affect both tool instances, and then sets some instance properties which just affects one of the instances.

Imports System.Diagnostics
Imports Infragistics.Win
Imports Infragistics.Win.UltraWinToolbars

	Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click

		' ----------------------------------------------------------------------------
		' Create 2 toolbars and add them to the UltraToolbarManager's toolbars collection.
		Me.UltraToolbarsManager1.Toolbars.AddToolbarRange(New String() {"MyToolbar1", "MyToolbar2"})


		' ----------------------------------------------------------------------------
		' Create a button tool and add it to both 'MyToolbar1' and 'MyToolbar2'.
		Dim buttonTool As New ButtonTool("MyButton")

		' Always add new tools to the UltraToolbarManager's root tools collection
		' before adding them to menus or toolbars.
		Me.UltraToolbarsManager1.Tools.Add(buttonTool)

		' Add 1 instance of the tool to 'MyToolbar1' and 1 instance to 'MyToolbar2'.
		Me.UltraToolbarsManager1.Toolbars("MyToolbar1").Tools.AddTool("MyButton")
		Me.UltraToolbarsManager1.Toolbars("MyToolbar2").Tools.AddTool("MyButton")


		' ----------------------------------------------------------------------------
		' Change some properties on 'MyButton' that will affect both instances of the
		' tool.  To do this we access the tool's SharedProps object.
		Me.UltraToolbarsManager1.Tools("MyButton").SharedProps.DisplayStyle = ToolDisplayStyle.ImageAndText
		Me.UltraToolbarsManager1.Tools("MyButton").SharedProps.Caption = "Basic Caption"
		Me.UltraToolbarsManager1.Tools("MyButton").SharedProps.AppearancesSmall.Appearance.Image = Bitmap.FromHicon(SystemIcons.Information.Handle)


		' ----------------------------------------------------------------------------
		' Change some properties on the instance of 'MyButton' that resides on 'MyToolbar1'.
		' To do this we get the instance of the tool in 'MyToolbar1' Tools collection
		' and access its InstanceProps object.
		Me.UltraToolbarsManager1.Toolbars("MyToolbar1").Tools("MyButton").InstanceProps.Caption = "Special Caption"
		Me.UltraToolbarsManager1.Toolbars("MyToolbar1").Tools("MyButton").InstanceProps.IsFirstInGroup = True

	End Sub
using System.Diagnostics;
using Infragistics.Win;
using Infragistics.Win.UltraWinToolbars;

		private void button1_Click(object sender, System.EventArgs e)
		{

			// ----------------------------------------------------------------------------
			// Create 2 toolbars and add them to the UltraToolbarManager's toolbars collection.
			this.ultraToolbarsManager1.Toolbars.AddToolbarRange(new string [] {"MyToolbar1", "MyToolbar2"} );


			// ----------------------------------------------------------------------------
			// Create a button tool and add it to both 'MyToolbar1' and 'MyToolbar2'.
			ButtonTool buttonTool = new ButtonTool("MyButton");

				// Always add new tools to the UltraToolbarManager's root tools collection
				// before adding them to menus or toolbars.
				this.ultraToolbarsManager1.Tools.Add(buttonTool);

				// Add 1 instance of the tool to 'MyToolbar1' and 1 instance to 'MyToolbar2'.
				this.ultraToolbarsManager1.Toolbars["MyToolbar1"].Tools.AddTool("MyButton");
				this.ultraToolbarsManager1.Toolbars["MyToolbar2"].Tools.AddTool("MyButton");


			// ----------------------------------------------------------------------------
			// Change some properties on 'MyButton' that will affect both instances of the
			// tool.  To do this we access the tool's SharedProps object.
			this.ultraToolbarsManager1.Tools["MyButton"].SharedProps.DisplayStyle	= ToolDisplayStyle.ImageAndText;
			this.ultraToolbarsManager1.Tools["MyButton"].SharedProps.Caption		= "Basic Caption";
			this.ultraToolbarsManager1.Tools["MyButton"].SharedProps.AppearancesSmall.Appearance.Image = Bitmap.FromHicon(SystemIcons.Information.Handle);


			// ----------------------------------------------------------------------------
			// Change some properties on the instance of 'MyButton' that resides on 'MyToolbar1'.
			// To do this we get the instance of the tool in 'MyToolbar1' Tools collection
			// and access its InstanceProps object.
			this.ultraToolbarsManager1.Toolbars["MyToolbar1"].Tools["MyButton"].InstanceProps.Caption			= "Special Caption";
			this.ultraToolbarsManager1.Toolbars["MyToolbar1"].Tools["MyButton"].InstanceProps.IsFirstInGroup	= true;

		}
Requirements

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

See Also