Version

OptionSet Class

OptionSet object.
Syntax
'Declaration
 
Public Class OptionSet 
   Inherits Infragistics.Shared.KeyedSubObjectBase
   Implements Infragistics.Shared.IKeyedSubObject, Infragistics.Shared.IKeyedSubObjectEx 
public class OptionSet : Infragistics.Shared.KeyedSubObjectBase, Infragistics.Shared.IKeyedSubObject, Infragistics.Shared.IKeyedSubObjectEx  
Example
The following code demonstrates how to create a group of StateButtonTools along with an OptionSet to control the coordination of button state across the tools. The code also places a separator in front of the first tool in the group.

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

	Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click

		' ----------------------------------------------------------------------------
		' Create a StateButton tool.
		Dim stateButtonAlignLeft As New StateButtonTool("AlignLeft")
		Dim stateButtonAlignCenter As New StateButtonTool("AlignCenter")
		Dim stateButtonAlignRight As New StateButtonTool("AlignRight")


		' Always add new tools to the UltraToolbarManager's root tools collection
		' before adding them to menus or toolbars.
		Me.UltraToolbarsManager1.Tools.AddRange(New ToolBase() {stateButtonAlignLeft, stateButtonAlignCenter, stateButtonAlignRight})


		' Specify images for the buttons
		stateButtonAlignLeft.SharedProps.AppearancesSmall.Appearance.Image = Bitmap.FromHicon(SystemIcons.Information.Handle)
		stateButtonAlignCenter.SharedProps.AppearancesSmall.Appearance.Image = Bitmap.FromHicon(SystemIcons.Exclamation.Handle)
		stateButtonAlignRight.SharedProps.AppearancesSmall.Appearance.Image = Bitmap.FromHicon(SystemIcons.WinLogo.Handle)


		' Set the menu display style for the buttons to display an image.
		stateButtonAlignLeft.MenuDisplayStyle = StateButtonMenuDisplayStyle.DisplayToolImage
		stateButtonAlignCenter.MenuDisplayStyle = StateButtonMenuDisplayStyle.DisplayToolImage
		stateButtonAlignRight.MenuDisplayStyle = StateButtonMenuDisplayStyle.DisplayToolImage


		' ----------------------------------------------------------------------------
		' Create an OptionSet object to coordinate the state (i.e., Checked or not Checked)
		' of the 3 state buttons.  
		Dim index As Integer = Me.UltraToolbarsManager1.OptionSets.Add(False, "MyAlignOptionSet")


		' Add the 3 state buttons to the option set.
		Me.UltraToolbarsManager1.OptionSets(index).Tools.AddToolRange(New String() {"AlignLeft", "AlignCenter", "AlignRight"})


		' ----------------------------------------------------------------------------
		' Check the 'AlignLeft' button.
		stateButtonAlignLeft.Checked = True


		' ----------------------------------------------------------------------------
		' Create a toolbar and add the state buttons to it.
		Me.UltraToolbarsManager1.Toolbars.AddToolbar("MyAlignmentToolbar")

		' Dock the toolbar to the bottom of the form.
		Me.UltraToolbarsManager1.Toolbars("MyAlignmentToolbar").DockedPosition = DockedPosition.Bottom

		' Add the state buttons to the toolbar.
		Me.UltraToolbarsManager1.Toolbars("MyAlignmentToolbar").Tools.AddToolRange(New String() {"AlignLeft", "AlignCenter", "AlignRight"})


		' Place a separator in front of the first button by setting its 'IsFirstInGroup' property.
		Me.UltraToolbarsManager1.Toolbars("MyAlignmentToolbar").Tools("AlignLeft").InstanceProps.IsFirstInGroup = True

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

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

			// ----------------------------------------------------------------------------
			// Create a StateButton tool.
			StateButtonTool stateButtonAlignLeft	= new StateButtonTool("AlignLeft");
			StateButtonTool stateButtonAlignCenter	= new StateButtonTool("AlignCenter");
			StateButtonTool stateButtonAlignRight	= new StateButtonTool("AlignRight");


			// Always add new tools to the UltraToolbarManager's root tools collection
			// before adding them to menus or toolbars.
			this.ultraToolbarsManager1.Tools.AddRange(new ToolBase [] {stateButtonAlignLeft, stateButtonAlignCenter, stateButtonAlignRight} );


			// Specify images for the buttons
			stateButtonAlignLeft.SharedProps.AppearancesSmall.Appearance.Image	 = Bitmap.FromHicon(SystemIcons.Information.Handle);
			stateButtonAlignCenter.SharedProps.AppearancesSmall.Appearance.Image = Bitmap.FromHicon(SystemIcons.Exclamation.Handle);
			stateButtonAlignRight.SharedProps.AppearancesSmall.Appearance.Image  = Bitmap.FromHicon(SystemIcons.WinLogo.Handle);


			// Set the menu display style for the buttons to display an image.
			stateButtonAlignLeft.MenuDisplayStyle	= StateButtonMenuDisplayStyle.DisplayToolImage;
			stateButtonAlignCenter.MenuDisplayStyle = StateButtonMenuDisplayStyle.DisplayToolImage;
			stateButtonAlignRight.MenuDisplayStyle	= StateButtonMenuDisplayStyle.DisplayToolImage;


			// ----------------------------------------------------------------------------
			// Create an OptionSet object to coordinate the state (i.e., Checked or not Checked)
			// of the 3 state buttons.  
			int index = this.ultraToolbarsManager1.OptionSets.Add(false, "MyAlignOptionSet");


			// Add the 3 state buttons to the option set.
			this.ultraToolbarsManager1.OptionSets[index].Tools.AddToolRange( new string [] {"AlignLeft", "AlignCenter", "AlignRight"} );


			// ----------------------------------------------------------------------------
			// Check the 'AlignLeft' button.
			stateButtonAlignLeft.Checked = true;


			// ----------------------------------------------------------------------------
			// Create a toolbar and add the state buttons to it.
			this.ultraToolbarsManager1.Toolbars.AddToolbar("MyAlignmentToolbar");

				// Dock the toolbar to the bottom of the form.
				this.ultraToolbarsManager1.Toolbars["MyAlignmentToolbar"].DockedPosition = DockedPosition.Bottom;

				// Add the state buttons to the toolbar.
				this.ultraToolbarsManager1.Toolbars["MyAlignmentToolbar"].Tools.AddToolRange(new string [] {"AlignLeft", "AlignCenter", "AlignRight"});


			// Place a separator in front of the first button by setting its 'IsFirstInGroup' property.
			this.ultraToolbarsManager1.Toolbars["MyAlignmentToolbar"].Tools["AlignLeft"].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