Version

FontListTool Class

Represents a drop down list of the fonts on the computer.
Syntax
'Declaration
 
Public Class FontListTool 
   Inherits ComboBoxTool
   Implements Infragistics.Shared.IKeyedSubObject, Infragistics.Shared.IKeyedSubObjectEx, Infragistics.Win.Notifications.INotificationBadgeProvider, Infragistics.Win.Notifications.INotificationBadgeSettingsOwner 
public class FontListTool : ComboBoxTool, Infragistics.Shared.IKeyedSubObject, Infragistics.Shared.IKeyedSubObjectEx, Infragistics.Win.Notifications.INotificationBadgeProvider, Infragistics.Win.Notifications.INotificationBadgeSettingsOwner  
Remarks

The FontListTool keeps track of the most recently chosen font's from the drop down. These can be accessed and modified through the MruItems property.

Example
The following code creates a toolbar as welll as a PopupColorPickerTool, FontListTool and PopupControlContainerTool and places the tools on the toolbar. It creates a WinForms checkbox control, attaches it to the PopupControlContainerTool and listens in on its Click event.

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

	Private Sub Button22_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button22.Click

		' ----------------------------------------------------------------------------
		' Create a toolbars and add it to the UltraToolbarManager's toolbars collection.
		Me.UltraToolbarsManager1.Toolbars.AddToolbar("FormattingOptions")


		' ----------------------------------------------------------------------------
		' Create a PopupColorPickerTool, FontListTool, PopupControlContainerTool and
		' ControlContainerTool and add them to the toolbar.
		Dim popupColorPickerTool As New PopupColorPickerTool("TextForeColor")
		Dim fontListTool As New FontListTool("TextFonts")
		Dim popupControlContainerTool As New PopupControlContainerTool("ShowMarkupText")
		Dim controlContainerTool As New ControlContainerTool("TextSize")


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


		' Add the tools to the toolbar.
		Me.UltraToolbarsManager1.Toolbars("FormattingOptions").Tools.AddTool("TextForeColor")
		Me.UltraToolbarsManager1.Toolbars("FormattingOptions").Tools.AddTool("TextFonts")
		Me.UltraToolbarsManager1.Toolbars("FormattingOptions").Tools.AddTool("ShowMarkupText")
		Me.UltraToolbarsManager1.Toolbars("FormattingOptions").Tools.AddTool("TextSize")


		' Set some properties on the FontListTool.
		Me.UltraToolbarsManager1.Toolbars("FormattingOptions").Tools("TextFonts").InstanceProps.IsFirstInGroup = True


		' Set some properties on the PopupColorPickerTool.
		popupColorPickerTool.SelectedColor = Color.Blue
		Me.UltraToolbarsManager1.Toolbars("FormattingOptions").Tools("TextForeColor").InstanceProps.IsFirstInGroup = True


		' Set some properties on the PopupControlContainerTool.
		popupControlContainerTool.SharedProps.Caption = "Options"
		Me.UltraToolbarsManager1.Toolbars("FormattingOptions").Tools("ShowMarkupText").InstanceProps.DisplayStyle = ToolDisplayStyle.TextOnlyAlways
		Me.UltraToolbarsManager1.Toolbars("FormattingOptions").Tools("ShowMarkupText").InstanceProps.IsFirstInGroup = True


		' Set some properties on the ControlContainerTool.
		Me.UltraToolbarsManager1.Toolbars("FormattingOptions").Tools("ShowMarkupText").InstanceProps.IsFirstInGroup = True


		' ----------------------------------------------------------------------------
		' Create a standard WinForms checkbox control and add it to the form.  This is
		' the tool we will host in the PopupControlContainer.
		Dim checkBox As New CheckBox()

		checkBox.Text = "Show Markup Text"
		checkBox.Width = 150

		' Set the visible property of the checkbox to false so it doesn't display until
		' needed by the PopupControlContainerTool.  The tool will automatically make it
		' visible bwfore dropping it down.
		checkBox.Visible = False

		Me.Controls.Add(checkBox)

		' Attach the checkbox control to the PopupControlContainerTool
		popupControlContainerTool.Control = checkBox

		' Listen to the checkbox's click event.
		AddHandler checkBox.Click, AddressOf Me.OnCheckboxClicked

		' Since we only have one checkbox control, don't allow multiple instances of the
		' PopupControlContainerTool to be created.
		popupControlContainerTool.SharedProps.AllowMultipleInstances = False


		' ----------------------------------------------------------------------------
		' Create a standard WinForms NumericUpDown control and add it to the form.  This is
		' the tool we will host in the ControlContainer.
		Dim numericUpDown As New NumericUpDown()

		numericUpDown.Minimum = 8
		numericUpDown.Maximum = 24
		numericUpDown.Increment = 2
		numericUpDown.Value = 8
		numericUpDown.Width = 50

		' Set the visible property of the NumericUpDown to false so it doesn't display until
		' needed by the ControlContainerTool.  The tool will automatically make it
		' visible before dropping it down.
		numericUpDown.Visible = False

		Me.Controls.Add(numericUpDown)

		' Attach the numericUpDown control to the ControlContainerTool
		controlContainerTool.Control = numericUpDown

		' Since we only have one NumericUpDown control, don't allow multiple instances of the
		' ControlContainerTool to be created.
		controlContainerTool.SharedProps.AllowMultipleInstances = False

	End Sub

	Private Sub OnCheckboxClicked(ByVal sender As Object, ByVal e As EventArgs)

		Debug.WriteLine("Checkbox clicked!")

		' Close the dropdown manually since PopupConrolContainerTools do not closeup automatically.
		Dim popupControlContainerTool As PopupControlContainerTool = Me.UltraToolbarsManager1.Toolbars("FormattingOptions").Tools("ShowMarkupText")

		If Not popupControlContainerTool Is Nothing Then
			popupControlContainerTool.ClosePopup()
		End If

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

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

			// ----------------------------------------------------------------------------
			// Create a toolbar and add it to the UltraToolbarManager's toolbars collection.
			this.ultraToolbarsManager1.Toolbars.AddToolbar("FormattingOptions");


			// ----------------------------------------------------------------------------
			// Create a PopupColorPickerTool, FontListTool, PopupControlContainerTool and
			// ControlContainerTool and add them to the toolbar.
			PopupColorPickerTool		popupColorPickerTool	 = new PopupColorPickerTool("TextForeColor");
			FontListTool				fontListTool			 = new FontListTool("TextFonts");
			PopupControlContainerTool	popupControlContainerTool= new PopupControlContainerTool("ShowMarkupText");
			ControlContainerTool		controlContainerTool	 = new ControlContainerTool("TextSize");


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


			// Add the tools to the toolbar.
			this.ultraToolbarsManager1.Toolbars["FormattingOptions"].Tools.AddTool("TextForeColor");
			this.ultraToolbarsManager1.Toolbars["FormattingOptions"].Tools.AddTool("TextFonts");
			this.ultraToolbarsManager1.Toolbars["FormattingOptions"].Tools.AddTool("ShowMarkupText");
			this.ultraToolbarsManager1.Toolbars["FormattingOptions"].Tools.AddTool("TextSize");


			// Set some properties on the FontListTool.
			this.ultraToolbarsManager1.Toolbars["FormattingOptions"].Tools["TextFonts"].InstanceProps.IsFirstInGroup = true;


			// Set some properties on the PopupColorPickerTool.
			popupColorPickerTool.SelectedColor = Color.Blue;
			this.ultraToolbarsManager1.Toolbars["FormattingOptions"].Tools["TextForeColor"].InstanceProps.IsFirstInGroup = true;


			// Set some properties on the PopupControlContainerTool.
			popupControlContainerTool.SharedProps.Caption = "Options";
			this.ultraToolbarsManager1.Toolbars["FormattingOptions"].Tools["ShowMarkupText"].InstanceProps.DisplayStyle = ToolDisplayStyle.TextOnlyAlways;
			this.ultraToolbarsManager1.Toolbars["FormattingOptions"].Tools["ShowMarkupText"].InstanceProps.IsFirstInGroup = true;


			// Set some properties on the ControlContainerTool.
			this.ultraToolbarsManager1.Toolbars["FormattingOptions"].Tools["ShowMarkupText"].InstanceProps.IsFirstInGroup = true;



			// ----------------------------------------------------------------------------
			// Create a standard WinForms checkbox control and add it to the form.  This is
			// the tool we will host in the PopupControlContainer.
			CheckBox checkBox = new CheckBox();

			checkBox.Text		= "Show Markup Text";
			checkBox.Width		= 150;

			// Set the visible property of the checkbox to false so it doesn't display until
			// needed by the PopupControlContainerTool.  The tool will automatically make it
			// visible before dropping it down.
			checkBox.Visible	= false;

			this.Controls.Add(checkBox);

			// Attach the checkbox control to the PopupControlContainerTool
			popupControlContainerTool.Control	= checkBox;

			// Listen to the checkbox's click event.
			checkBox.Click	+= new System.EventHandler(this.OnCheckboxClicked);

			// Since we only have one checkbox control, don't allow multiple instances of the
			// PopupControlContainerTool to be created.
			popupControlContainerTool.SharedProps.AllowMultipleInstances = false;



			// ----------------------------------------------------------------------------
			// Create a standard WinForms NumericUpDown control and add it to the form.  This is
			// the tool we will host in the ControlContainer.
			NumericUpDown numericUpDown = new NumericUpDown();

			numericUpDown.Minimum	= 8;
			numericUpDown.Maximum	= 24;
			numericUpDown.Increment	= 2;
			numericUpDown.Value		= 8;
			numericUpDown.Width		= 50;

			// Set the visible property of the NumericUpDown to false so it doesn't display until
			// needed by the ControlContainerTool.  The tool will automatically make it
			// visible before dropping it down.
			numericUpDown.Visible	= false;

			this.Controls.Add(numericUpDown);

			// Attach the numericUpDown control to the ControlContainerTool
			controlContainerTool.Control = numericUpDown;

			// Since we only have one NumericUpDown control, don't allow multiple instances of the
			// ControlContainerTool to be created.
			controlContainerTool.SharedProps.AllowMultipleInstances = false;

		}
		
		private void OnCheckboxClicked(object sender, EventArgs e)
		{

			Debug.WriteLine("Checkbox clicked!");

			// Close the dropdown manually since PopupConrolContainerTools do not closeup automatically.
			PopupControlContainerTool popupControlContainerTool = this.ultraToolbarsManager1.Toolbars["FormattingOptions"].Tools["ShowMarkupText"] as PopupControlContainerTool;

			if (popupControlContainerTool != null)
				popupControlContainerTool.ClosePopup();

		}
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