FontControl element

Represents a Font Control, which is a specialized container of individual controls dedicated to font manipulation.

Usage

<FontControl
  CommandName = "xs:positiveInteger or xs:string"
  FontType = "xs:string"
  IsGrowShrinkButtonGroupVisible = "Boolean"
  IsStrikethroughButtonVisible = "Boolean"
  IsUnderlineButtonVisible = "Boolean"
  IsHighlightButtonVisible = "Boolean"
  ShowVerticalFonts = "Boolean"
  ShowTrueTypeOnly = "Boolean"
  MinimumFontSize = "xs:positiveInteger"
  MaximumFontSize = "xs:positiveInteger"/>

Attributes

Attribute Type Required Description
CommandName
xs:positiveInteger or xs:string
No
Associates the element with a Command.

(xs:positiveInteger or xs:string)
A string, an integer value between 2 and 59999, inclusive, or a hexadecimal value between 0x2 and 0xea5f, inclusive.
The value must be unique within the Ribbon XML document.
Maximum length: 100 characters.
FontType
xs:string
No
Restricted to one of the following values:

(FontOnly)
Default.
Screen shot of the FontControl element with the FontOnly attribute set to true.
Setting the FontType attribute to FontOnly enables the following functionality:
  • Font family combo box.
  • Font Size combo box.
  • Bold, Italic, Underline, and Strikethrough toggle buttons.

    [!Note]
    The Strikethrough and Underline toggle buttons are displayed by default but can be hidden by setting the IsStrikethroughButtonVisible and IsUnderlineButtonVisible attributes to false.


(FontWithColor)
Screen shot of the FontControl element with the FontWithColor attribute set to true.
Setting the FontType attribute to FontWithColor enables the following functionality:
  • Font family combo box.
  • Font size combo box.
  • Grow font and Shrink font font size increment and decrement buttons.
  • Bold, Italic, Underline, and Strikethrough toggle buttons.

    [!Note]
    The Strikethrough and Underline toggle buttons are displayed by default but can be hidden by setting the IsStrikethroughButtonVisible and IsUnderlineButtonVisible attributes to false.


  • Text color color picker.
  • Text highlight color color picker.

    [!Note]
    This control is hidden by default but can be displayed by setting the IsHighlightButtonVisible attribute to true.


(RichFont)
Screen shot of the FontControl element with the RichFont attribute set to true.
Setting the FontType attribute to RichFont enables the following functionality:
  • Font family combo box.
  • Font size combo box.
  • Grow font and Shrink font font size increment and decrement buttons.
  • Bold, Italic, Underline, and Strikethrough toggle buttons.

    [!Note]
    The Strikethrough and Underline toggle buttons are displayed by default and cannot be hidden by setting the IsStrikethroughButtonVisible and IsUnderlineButtonVisible attributes to false.


  • Text color color picker.
  • Text highlight color color picker.

    [!Note]
    This control is displayed by default and cannot be hidden by setting the IsHighlightButtonVisible attribute to false.


  • Subscript and Superscript toggle buttons.
IsGrowShrinkButtonGroupVisible
Boolean
No
Windows 8 and newer
Restricted to one of the following values:
[!Note]
The Grow/Shrink buttons are never displayed in the MiniToolbar.


(true)
Default when the value of FontType equals FontWithColor or RichFont.
(false)
Default when the value of FontType equals FontOnly.
IsHighlightButtonVisible
Boolean
No
Restricted to one of the following values (0 and 1 are not valid):
[!Note]
Color highlighting is available only from a FontControl when the value of the FontType attribute equals FontWithColor or RichFont.


(true)
Default when the value of FontType equals FontWithColor or RichFont.
Valid only when the value of FontType equals FontWithColor or RichFont.
(false)
Default when the value of FontType equals FontOnly.
Valid only when the value of FontType equals FontOnly or FontWithColor.
IsStrikethroughButtonVisible
Boolean
No
Restricted to one of the following values (0 and 1 are not valid):

(true)
Default.
(false)
Valid only when the value of FontType equals FontOnly or FontWithColor.
IsUnderlineButtonVisible
Boolean
No
Restricted to one of the following values (0 and 1 are not valid):

(true)
Default.
(false)
Valid only when the value of FontType equals FontOnly or FontWithColor.
MaximumFontSize
xs:positiveInteger
No
The maximum point size to display.

(xs:positiveInteger)
An integer value between 1 and 9999, inclusive.
Default is 9999.
MinimumFontSize
xs:positiveInteger
No
The minimum point size to display.

(xs:positiveInteger)
An integer value between 1 and 9999, inclusive.
Default is 1.
ShowTrueTypeOnly
Boolean
No
Restricted to one of the following values (0 and 1 are not valid):

(true)
Displays TrueType and OpenType fonts only.
(false)
Default. No restriction is placed on the type of fonts displayed.
ShowVerticalFonts
Boolean
No
Restricted to one of the following values (0 and 1 are not valid):
[!Note]
Vertical fonts are preceded by an @ symbol in the Font family list.


(true)
Default. Displays the vertical fonts that are set to Show in the Fonts control panel.
(false)
Allows an application that does not support vertical text to hide any vertical fonts that are set to Show in the Fonts control panel.
[!Note]
In Windows Vista, the Fonts control panel does not offer Show or Hide functionality. In this case, the ShowVerticalFonts attribute must be set to False.

Child elements

There are no child elements.

Parent elements

Element
ControlGroup
Group
MenuGroup

Remarks

Optional.

May occur at most once for each ControlGroup, Group, or MenuGroup element.

Any FontControl Command attributes declared in markup, such as Command.LabelTitle or Command.TooltipTitle, are overridden by the attributes of the individual controls that comprise the FontControl.

Any attempt to select a color swatch from the color picker of a Font Control may result in an access violation if no Command handler is associated with the control.

Examples

The following example demonstrates the basic markup for the three types of Font Control.

This section of code shows the FontControl Command declarations, each with a Group container declaration.

<!-- A FontOnly FontControl -->
<Command Name="cmdFontOnlyGroup"
         Symbol="cmdFontOnlyGroup"
         Comment="FontOnlyGroup"
         Id="50001"
         LabelTitle="FontOnly"/>
<Command Name="cmdFontOnly"
         Symbol="cmdFontOnly"
         Comment="FontOnly"
         Id="50010"/>

<!-- A FontWithColor FontControl -->
<Command Name="cmdFontWithColorGroup"
         Symbol="cmdFontWithColorGroup"
         Comment="FontWithColorGroup"
         Id="50002"
         LabelTitle="FontWithColor"/>
<Command Name="cmdFontWithColor"
         Symbol="cmdFontWithColor"
         Comment="FontWithColor"
         Id="50020"/>

<!-- A RichFont FontControl -->
<Command Name="cmdRichFontGroup"
         Symbol="cmdRichFontGroup"
         Comment="RichFontGroup"
         Id="50003"
         LabelTitle="RichFont"
         Keytip="ZF"/>
<Command Name="cmdRichFont"
         Symbol="cmdRichFont"
         Comment="RichFont"
         Id="50030"
         Keytip="RF"
         LabelTitle="test"
         TooltipTitle="test"/>

This section of code shows the FontControl control declarations where each FontControl and Group is declared in a single Tab.

<Tab CommandName="cmdTab1">
  <Group CommandName="cmdFontOnlyGroup"
         SizeDefinition="OneFontControl">
    <FontControl CommandName="cmdFontOnly"
                 FontType="FontOnly"
                 IsUnderlineButtonVisible="false"
                 IsStrikethroughButtonVisible="false"
                 MinimumFontSize="15"/>
  </Group>
  <Group CommandName="cmdFontWithColorGroup"
         SizeDefinition="OneFontControl">
    <FontControl CommandName="cmdFontWithColor"
                 FontType="FontWithColor"
                 IsUnderlineButtonVisible="false"
                 IsStrikethroughButtonVisible="false"
                 IsHighlightButtonVisible="true"
                 MinimumFontSize="15"/>
  </Group>
  <Group CommandName="cmdRichFontGroup"
         SizeDefinition="OneFontControl">
    <FontControl CommandName="cmdRichFont"
                 FontType="RichFont"
                 IsHighlightButtonVisible="true"
                 IsUnderlineButtonVisible="true"
                 IsStrikethroughButtonVisible="true"
                 ShowVerticalFonts="true"
                 MinimumFontSize="15"/>
  </Group>

Element information

  • Minimum supported system: Windows 7
  • Can be empty: Yes

See also

Font Control control

Font Control Properties

FontControl Sample