Class SpeedButton
Implements speed button control. Speed buttons are often used in toolbars or as part of a user interface.
[ControlCategory("MenusAndToolbars")]
public class SpeedButton : GraphicControl, IBaseObjectWithAttr, IBaseObjectWithId, INotifyPropertyChanged, IDisposableObject, IBaseObject, ISupportInitialize, IFocusable, ITextProperty, IComponent, IControl, IDisposable, IWin32Window, ILayoutItem, INotifyDataErrorInfo, ICommandSource
- Inheritance
-
SpeedButton
- Implements
- Derived
Examples
Here is how to declare a SpeedButton in UIXML:
<SpeedButton Name="button1" Click="Button_Click" HorizontalAlignment="Right"
ToolTip = "Some hint" Shortcut="Ctrl+O" Text="Ok" TextVisible="true"/>
Also, a SpeedButton can be created from code:
public SpeedButton CreateSpeedButton()
{
SpeedButton result = new()
{
Text = "Cancel",
TextVisible = true,
ToolTip = "Some hint",
Parent = buttonPanel,
ShortcutKeys = Keys.Control | Keys.A,
Name = "cancelBtn",
Enabled = false,
HorizontalAlignment = HorizontalAlignment.Right,
};
result.ImageSet = KnownSvgImages.ImgCancel.AsNormal(32, result.IsDarkBackground);
result.DisabledImageSet = KnownSvgImages.ImgCancel.AsDisabled(32, result.IsDarkBackground);
result.Click += Button_Click;
return result;
}
Remarks
Example of how a SpeedButton can look:

Constructors
- SpeedButton()
Initializes a new instance of the SpeedButton class.
- SpeedButton(Control)
Initializes a new instance of the SpeedButton class.
Fields
- CheckBorderTheme
Gets or sets default color and style settings for all SpeedButton controls which have UseTheme equal to CheckBorder.
- DefaultClickRepeatDelay
Gets or sets default click repeat delay used when IsClickRepeated is True.
- DefaultCustomTheme
Gets or sets default color and style settings for all SpeedButton controls which have UseTheme equal to Custom.
- DefaultImageLabelDistance
Gets or sets default image and label distance in the SpeedButton.
- DefaultPadding
Gets or sets default padding in the SpeedButton.
- DefaultRoundBorderRadius
Represents the default border radius used for rounding corners. This value is used in the RoundBorder theme.
- DefaultRoundBorderRadiusIsPercent
Indicates whether the default round border radius is expressed as a percentage. This value is used in the RoundBorder theme.
- DefaultStickyBorderWidth
Gets or sets default border width of the SpeedButton in the sticky state.
- DefaultTheme
Gets or sets default color and style settings for all SpeedButton controls which have UseTheme equal to Default.
- DefaultUseTheme
Gets ot sets default value of UseTheme property.
- DefaultUseThemeForSticky
Gets ot sets default value of UseThemeForSticky property.
- NoBorderTheme
Gets or sets default color and style settings for all SpeedButton controls which have UseTheme equal to NoBorder.
- PushButtonHoveredTheme
Gets or sets default color and style settings for all SpeedButton controls which have UseTheme equal to PushButtonHovered.
- PushButtonPressedTheme
Gets or sets default color and style settings for all SpeedButton controls which have UseTheme equal to PushButtonPressed.
- PushButtonTheme
Gets or sets default color and style settings for all SpeedButton controls which have UseTheme equal to PushButton.
- RoundBorderTheme
Gets or sets default color and style settings for all SpeedButton controls which have UseTheme equal to RoundBorder.
- StaticBorderTheme
Gets or sets default color and style settings for all SpeedButton controls which have UseTheme equal to StaticBorder.
- StickyBorderTheme
Gets or sets default color and style settings for all SpeedButton controls which have UseTheme equal to StickyBorder.
- TabControlTheme
Gets or sets default color and style settings for all SpeedButton controls which have UseTheme equal to TabControl.
Properties
- AllChildrenInLayout
Gets all child controls which are visible and included in the layout.
- BorderColor
Gets or sets border color override. Currently is not implemented. Added for the compatibility with legacy code.
- ClickAction
Gets or sets Action which will be executed when this control is clicked by the user.
- ClickRepeatDelay
Gets or sets click repeat delay used when IsClickRepeated is True.
- Command
The command that will be executed when the class is "invoked". Classes that implement this interface should enable or disable based on the command's CanExecute(object?) return value.
- CommandParameter
Gets the parameter that will be passed to the command when executing it.
- CommandTarget
An element that an implementor may wish to target as the destination for the command. The property may be implemented as read-write if desired.
- CustomTheme
Gets or sets default color and style settings for all SpeedButton controls which have UseTheme equal to Custom.
- DefaultShortcutToolTipTemplate
Gets or sets default template for the shortcut when it is shown in the tooltip.
- DisabledImage
Gets or sets the disabled image that is displayed by the control.
- DisabledImageSet
Gets or sets the disabled ImageSet that is displayed by the control.
- Enabled
Gets or sets a value indicating whether the control can respond to user interaction.
- Font
Gets or sets the font of the text displayed by the control.
- HasImage
Gets a value indicating whether Image, ImageSet or SvgImage is associated with the current instance.
- HasLabelImage
Gets a value indicating whether the label has an associated image.
- HasVisibleImage
Gets whether control has image and it is visible.
- HideToolTipOnClick
Gets or sets whether ToolTip will be hidden when control is clicked. Default is
true.
- Image
Gets or sets the image that is displayed by the control.
- ImageHorizontalAlignment
Gets or sets horizontal alignment of the image.
- ImageLabelDistance
Gets or sets distance between image and label.
- ImageStretch
Gets or sets a value indicating whether the image should be stretched to fill its container. Default is
false.
- ImageToText
Gets or sets the layout relationship between the image and text content within the control.
- ImageVerticalAlignment
Gets or sets vertical alignment of the image.
- ImageVisible
Gets or sets a value indicating whether to draw image.
- IsBold
Gets or sets whether font style override is bold.
- IsClickRepeated
Gets or sets whether mouse clicks are repeated continuously while left mouse button is pressed.
- IsToolTipEnabled
Gets or sets a value indicating whether tooltip is shown when mouse hovers over the control.
- IsVerticalText
Gets or sets a value indicating whether the text should be rendered vertically.
- LabelHorizontalAlignment
Gets or sets horizontal alignment of the label.
- LabelImage
Gets or sets the image that is displayed by the control's label. This is an additional image that can be displayed alongside the main Image.
- LabelVerticalAlignment
Gets or sets vertical alignment of the label.
- MinRightSideWidth
Gets or sets the minimum width of the right side element in dips.
- RightSideDisabledImage
Gets or sets the image displayed on the right side of the control when it is disabled.
- RightSideElement
Gets or sets the type of element displayed on the right side of the control.
- RightSideImage
Gets or sets the image displayed on the right side of the control.
- RightSideText
Gets or sets the text displayed on the right side of the control.
- Shortcut
Gets or sets a value indicating the associated shortcut key.
- ShortcutInfo
Gets or sets a value indicating the associated shortcut key.
- ShortcutKeyInfo
Gets or sets a value indicating the associated shortcut key.
- ShortcutKeys
Gets or sets the associated shortcut keys.
- ShortcutToolTipTemplate
Gets or sets template for the shortcut when it is shown in the tooltip.
- ShowDropDownMenuWhenHovered
Gets or sets a value indicating whether the drop-down menu is displayed when the user hovers over the associated control.
- SpacerHorizontalAlignment
Gets or sets horizontal alignment of the spacer.
- SpacerVerticalAlignment
Gets or sets vertical alignment of the spacer.
- Sticky
Gets or sets whether control is sticky.
- StickySpreadMode
Gets or sets the mode that defines how the Sticky state is propagated to sibling SpeedButton controls when this control becomes sticky.
- StickyToggleOnClick
Gets or sets whether Sticky is toggled when control is clicked.
- StickyVisualStateOverride
Gets or sets override for VisualState when Sticky is True.
- SvgImage
Gets or sets the svg image that is displayed by the control.
- SvgSize
Gets or sets the svg image size.
- Text
Gets or sets the text associated with this control.
- TextVisible
Gets or sets whether to display text in the control.
- UseDefaultTheme
Gets or sets whether to use DefaultTheme.
- UseTheme
Gets or sets whether to use DefaultTheme.
- UseThemeForSticky
Gets or sets color theme when Sticky is True.
- VisualState
Gets current VisualControlState.
Methods
- Assign(IMenuItemProperties)
Assigns the properties of the specified menu item to the current instance.
- ConfigureAsMenuItem()
Configures the content to match the appearance of a menu item.
- CreateBorders(Color)
Creates borders for the SpeedButton using default border width and using specified
color.
- DefaultPaint(PaintEventArgs)
Default painting method of the UserControl and its descendants.
- DisposeManaged()
Override to dispose managed resources. Here we dispose all used object references.
- GetDefaultTheme()
Gets default color and style settings.
- GetPreferredSize(PreferredSizeContext)
Retrieves the size of a rectangular area into which a control can be fitted, in device-independent units.
- GetRealToolTip()
Gets ToolTip value for use in the native control.
- GetRightSideElement()
Retrieves the element displayed on the right side based on the current configuration.
- GetRightSideElements(ref DrawLabelParams)
Generates an array of drawing parameters for the right-side elements of a label.
- GetShortcutText(bool, bool)
Retrieves the text representation of the shortcut key, optionally formatted using a template.
- GetShortcuts()
Adds list of shortcuts associated with the control and its child controls. Only visible and enabled child controls are queried.
- InitThemeDark(ControlStateSettings)
Initializes default colors and styles for the SpeedButton using 'Dark' color theme.
- InitThemeLight(ControlStateSettings)
Initializes default colors and styles for the SpeedButton using 'Light' color theme.
- LoadSvg(string, SizeI)
Loads normal and disabled image from the specified file or resource url. Loaded images assigned to ImageSet and DisabledImageSet properties.
- OnBeforeDrawLabel(object?, EventArgs)
Invoked before a label is drawn, allowing for custom handling or modifications.
- OnClick(EventArgs)
Called when the control is clicked.
- OnClickRepeatTimerEvent()
Invoked periodically while the control remains in the pressed state. This method is called only when IsClickRepeated is set to true.
- OnDataContextChanged(object?, object?)
Called when the DataContext property changes.
- OnImageToTextChanged()
Called when ImageToText property is changed.
- OnMenuItemChanged(object?, BaseEventArgs<MenuChangeKind>)
Invoked when attached menu item change event occurs.
- OnMouseDown(MouseEventArgs)
Called when the mouse button was pressed.
- OnMouseHover(EventArgs)
Called when the mouse pointer hovers over the control.
- OnMouseUp(MouseEventArgs)
Called when the mouse button was released.
- OnStickyChanged(EventArgs)
Called when Sticky property is changed.
- OnSystemColorsChanged(EventArgs)
Called when the SystemColorsChanged event is raised.
- OnVisualStateChanged(EventArgs)
Called when VisualStateChanged property is changed.
- PictureSizeChanged()
Handles changes to the picture size.
- RaiseClick(EventArgs)
Raises the Click event and calls OnClick(EventArgs). See Click event description for more details.
- RaiseFontChanged(EventArgs)
Raises the FontChanged event and calls OnFontChanged(EventArgs) method.
- RaiseStickyChanged(EventArgs)
Raises StickyChanged event and OnStickyChanged(EventArgs) method.
- ResetImages()
Resets the image and disabled image to null.
- SetContentHorizontalAlignment(HorizontalAlignment)
Sets the horizontal alignment of the content elements within the control.
- SetContentHorizontalAlignment(HorizontalAlignment, HorizontalAlignment, HorizontalAlignment)
Sets the horizontal alignment for the content elements within the control.
- SetContentVerticalAlignment(VerticalAlignment)
Sets the vertical alignment for the content elements within the control.
- SetDefaultComboBoxImage(int?)
Sets the default combo box image for the control.
- SetImage(KnownButtonImage)
Sets the image and alignment properties for a button based on the specified configuration.
- SetImageSets(ImageSet?, ImageSet?)
Sets the images for the control.
- SetImages(Image?, Image?)
Sets the images for the control.
- SetImages(Image?, Image?, ImageSet?, ImageSet?)
Sets the images for the control.
- SetLabelImage(SvgImage?, KnownButton?, HVAlignment?, CoordAndUnit?)
Sets the label's image using the specified SVG image, button type, alignment, and size.
- SetLabelImage(KnownButtonImage)
Sets the label image for a button using the specified predefined image, button type, alignment, and size.
- SetLabelImageAsComboBox(HVAlignment?, CoordAndUnit?)
Configures the label image to represent a combo box control.
- SetLabelImageAsMenuArrow()
Sets the label image to a default arrow image, typically used to indicate a submenu or navigation direction.
- SetRightSideImage(KnownButtonImage)
Sets the right-side image for the toolbar button using the specified SVG image and optional parameters.
- SetSvg(SvgImage?, KnownButton?, CoordAndUnit?)
Sets the SVG image for a toolbar button, along with its corresponding disabled state image.
- SetSvgImage(SvgImage?, KnownButton?, int?)
Sets the SVG image for the control.
- ShowComboBoxImageAtRight()
Shows default combo box image at the right side of the control.
- ShowDropDownMenu(Action?)
Shows attached drop down menu.
- SubscribeClickRepeated()
Subscribes to the click repeated event, initializing and starting timers to handle repeated click actions.
- UnsubscribeClickRepeated()
Unsubscribes from repeated click events and releases associated resources.
- UpdateSiblingStickyState()
Updates the sticky state of sibling
SpeedButtoncontrols based on the current button’sIsStickysetting and StickySpreadMode.
Events
- StickyChanged
Occurs when Sticky property is changed.