Skip to main content

RibbonToggleButton Class

A toggle button within a RibbonControl.

Namespace: DevExpress.WinUI.Ribbon

Assembly: DevExpress.WinUI.Ribbon.v23.2.dll

NuGet Package: DevExpress.WinUI

Declaration

public class RibbonToggleButton :
    RibbonButtonBase

Remarks

WinUI RibbonControl - ToggleButton

The following code sample displays a RibbonToggleButton in a RibbonControl:

<Window ... 
    xmlns:dxr="using:DevExpress.WinUI.Ribbon">
    <Grid>
        <dxr:RibbonControl>
            <dxr:RibbonControl.Tabs>
              <dxr:RibbonTab Caption="Home" >
                  <dxr:RibbonGroup Caption="File">
                      <dxr:RibbonToggleButton ItemType="SmallWithoutText" Content="Bold">
                            <dxr:RibbonToggleButton.SmallIcon>
                                <dxc:DXSymbolIconSource Symbol="Bold"/>
                            </dxr:RibbonToggleButton.SmallIcon>
                        </dxr:RibbonToggleButton>
                        <!-- ... -->
                  </dxr:RibbonGroup>
              </dxr:RibbonTab>
            </dxr:RibbonControl.Tabs>
        </dxr:RibbonControl>
        <!-- ... -->
    </Grid>
</Window>

Specify the RibbonButtonBase.Content property to display text next to the button icon.

Commands

Use the Command property to specify a command that is invoked when a user clicks a RibbonToggleButton.

The RibbonControl includes the CommandParameter property that allows you to specify a command’s parameter.

Button Icon

You can use the following properties to display a button icon:

Property Description Image
SmallIcon Gets or sets the ribbon button’s small icon (16x16 px). This is a dependency property. WinUI RibbonControl - Large Item
LargeIcon Gets or sets the ribbon button’s large icon (32x32 px). This is a dependency property. WinUI RibbonControl - Large Item

Customize Appearance

Display Modes

The RibbonToggleButton class contains the DisplayMode property that defines the button size and text.

Property Description Image
Default If active, a ribbon item can be displayed as a large image with a caption. -
Large

If active, a ribbon item can be displayed as a large image with a caption.

WinUI RibbonControl - Large Item
SmallWithoutText

If active, a ribbon item can be displayed as a small image.

WinUI RibbonControl - Large Item
SmallWithText

If active, a ribbon item can be displayed as a small image with a caption.

WinUI RibbonControl - Large Item

Appearance Settings

To customize a RibbonToggleButton‘s appearance settings, you can use the following StyleSettings:

Property Description
CheckedBackground Gets or sets a RibbonToggleButton‘s checked state background. This is a dependency property.
CheckedForeground Gets or sets a RibbonToggleButton‘s checked state foreground. This is a dependency property.
CheckedBorderBrush Gets or sets a checked RibbonToggleButton‘s border brush. This is a dependency property.
CheckedDisabledBackground Gets or sets a RibbonToggleButton‘s disabled state background when the button is checked. This is a dependency property.
CheckedDisabledForeground Gets or sets a RibbonToggleButton‘s disabled state foreground when the button is checked. This is a dependency property.
CheckedDisabledBorderBrush Gets or sets a disabled RibbonToggleButton‘s border brush when the button is checked. This is a dependency property.
CheckedHoverBackground Gets or sets a RibbonToggleButton‘s hovered state background when the button is checked. This is a dependency property.
CheckedHoverForeground Gets or sets a hovered RibbonToggleButton‘s foreground when the button is checked. This is a dependency property.
CheckedHoverBorderBrush Gets or sets a hovered RibbonToggleButton‘s border brush when the button is checked. This is a dependency property.
CheckedPressedBackground Gets or sets a pressed RibbonToggleButton‘s background when the button is checked. This is a dependency property.
CheckedPressedForeground Gets or sets a pressed RibbonToggleButton‘s foreground when the button is checked. This is a dependency property.
CheckedPressedBorderBrush Gets or sets a pressed RibbonToggleButton‘s border brush when the button is checked. This is a dependency property.
BorderThickness Gets or sets a ribbon button’s border thickness. This is a dependency property.
CornerRadius Gets or sets a corner radius of the ribbon button’s border. This is a dependency property.
DisabledBackground Gets or sets a ribbon button’s disabled state background. This is a dependency property.
DisabledBorderBrush Gets or sets a ribbon button’s disabled state border brush. This is a dependency property.
DisabledForeground Gets or sets a ribbon button’s disabled state foreground. This is a dependency property.
HoverBackground Gets or sets a ribbon button’s hovered state background. This is a dependency property.
HoverBorderBrush Gets or sets a ribbon button’s hovered state border brush. This is a dependency property.
HoverForeground Gets or sets a ribbon button’s hovered state foreground. This is a dependency property.
NormalBackground Gets or sets a ribbon button’s normal state background. This is a dependency property.
NormalBorderBrush Gets or sets a ribbon button’s normal state border brush. This is a dependency property.
NormalForeground Gets or sets a ribbon button’s normal state foreground. This is a dependency property.
PressedBackground Gets or sets a ribbon button’s pressed state background. This is a dependency property.
PressedBorderBrush Gets or sets a ribbon button’s pressed state border brush. This is a dependency property.
PressedForeground Gets or sets a ribbon button’s pressed state foreground. This is a dependency property.

ToolTip

You can use the following properties to display a RibbonToggleButton‘s tooltip:

Property Description
ToolTip Gets or sets the ribbon button’s tooltip. This is a dependency property.
ToolTipDescription Gets or sets the ribbon button’s tooltip description text that is displayed under the ToolTipTitle. This is a dependency property.
ToolTipTitle Gets or sets the ribbon button’s tooltip title text. This is a dependency property.

Inheritance

Object
DependencyObject
UIElement
FrameworkElement
DevExpress.WinUI.Core.Internal.DXLogicalFrameworkElement
See Also