HypernovaDesktop Components · docs
Binarymission
WPF › Ribbon › BinaryRibbonToggleButtonControl

BinaryRibbonToggleButtonControl

class.NET 6 / 8 / 10.NET Framework 4.8Binarymission.WPF.Controls.Office

A ribbon button that stays pressed while it is on – Bold, Show Ruler, Track Changes – drawn large, medium or small as the ribbon gives it room.

public class BinaryRibbonToggleButtonControl : ToggleButton, IBinaryRibbonContentElementBoundsConfigurable, IBinaryRibbonKeyTipControl

Inherits from / implements: ToggleButton, IBinaryRibbonContentElementBoundsConfigurable, IBinaryRibbonKeyTipControl

Remarks

It is a WPF ToggleButton: bind or read IsChecked, or handle Checked and Unchecked. While it is checked it is drawn pressed.

Pictures, caption and size

As for BinaryRibbonButton: large shows LargeImage over the caption (ContentControl.Content), medium shows SmallImage beside it, and small the picture alone; with no small picture the large one is drawn scaled down. The size is set by the BinaryRibbonGroup holding the button, or by a BinaryRibbonButtonGroup, which always draws it small.

Keyboard

A key tip (BinaryKeyTip.AccessKeyProperty) turns it on or off.

Examples

<ribbon:BinaryRibbonGroup TitleText="Show"
        xmlns:ribbon="clr-namespace:Binarymission.WPF.Controls.Office;assembly=Binarymission.WPF.Controls.BinaryRibbon">
    <ribbon:BinaryRibbonToggleButtonControl Content="Ruler" SmallImage="Images/Ruler16.png"
                                            ribbon:BinaryRibbonBarPanel.MaxSize="Medium"
                                            ribbon:BinaryKeyTip.AccessKey="R"
                                            IsChecked="{Binding IsRulerVisible, Mode=TwoWay}" />
    <ribbon:BinaryRibbonToggleButtonControl Content="Gridlines" SmallImage="Images/Grid16.png"
                                            ribbon:BinaryRibbonBarPanel.MaxSize="Medium"
                                            IsChecked="{Binding AreGridlinesVisible, Mode=TwoWay}" />
</ribbon:BinaryRibbonGroup>

See also

Members at a glance

Properties
BinaryRibbonTagGets or sets any object of your own to keep with the button.
CornerRadiusGets or sets how rounded the corners of the button's frame and highlight are.
IsFlatGets or sets whether the button should be drawn flat.
LargeImageGets or sets the picture the button shows when the ribbon draws it large.
SmallImageGets or sets the picture the button shows when the ribbon draws it medium or small.
Fields
CornerRadiusPropertyIdentifies the CornerRadius dependency property.
IsFlatPropertyIdentifies the IsFlat dependency property.
LargeImagePropertyIdentifies the LargeImage dependency property.
SmallImagePropertyIdentifies the SmallImage dependency property.

Properties

BinaryRibbonTag

public object BinaryRibbonTag

Gets or sets any object of your own to keep with the button.

Value
Any object. The default is null.
Remarks

The ribbon never reads it. It is a plain property, not a dependency property, so it cannot be the target of a binding or a style setter; use FrameworkElement.Tag for that.

CornerRadius

public CornerRadius CornerRadius

Gets or sets how rounded the corners of the button's frame and highlight are.

Value
The radius of each corner, in device-independent units (1/96 inch). The default is 4 on every corner.
Remarks

Inside a BinaryRibbonButtonGroup the group sets this itself, so a value set on the button there is replaced.

IsFlat

public bool IsFlat

Gets or sets whether the button should be drawn flat.

Value
The default is true.
Remarks

The button's built-in templates do not read this property; it changes nothing on screen.

LargeImage

public ImageSource LargeImage

Gets or sets the picture the button shows when the ribbon draws it large.

Value
The picture, drawn 32 x 32 device-independent units. The default is null.
Remarks

When SmallImage is null, this picture is also used, scaled down, for the medium and small sizes.

See also

SmallImage

public ImageSource SmallImage

Gets or sets the picture the button shows when the ribbon draws it medium or small.

Value
The picture, drawn 16 x 16 device-independent units. The default is null, which shows LargeImage scaled down instead.
Remarks

A large button does not fall back to this picture: give it a LargeImage.

See also

Fields

CornerRadiusProperty static

public static readonly DependencyProperty CornerRadiusProperty

Identifies the CornerRadius dependency property.

IsFlatProperty static

public static readonly DependencyProperty IsFlatProperty

Identifies the IsFlat dependency property.

LargeImageProperty static

public static readonly DependencyProperty LargeImageProperty

Identifies the LargeImage dependency property.

SmallImageProperty static

public static readonly DependencyProperty SmallImageProperty

Identifies the SmallImage dependency property.