Back to Devexpress

ButtonInfoBase.Padding Property

wpf-devexpress-dot-xpf-dot-editors-dot-buttoninfobase-3a4d0d6c.md

latest6.4 KB
Original Source

ButtonInfoBase.Padding Property

Gets or sets the button’s padding. This is a dependency property.

Namespace : DevExpress.Xpf.Editors

Assembly : DevExpress.Xpf.Core.v25.2.dll

NuGet Package : DevExpress.Wpf.Core

Declaration

csharp
public Thickness Padding { get; set; }
vb
Public Property Padding As Thickness

Property Value

TypeDescription
Thickness

The button’s padding.

|

Remarks

The following code sample specifies the ButtonInfo’s Padding , Background, BorderThickness, BorderBrush, CornerRadius, and EditorAppearanceProperties.FocusedBorderBrush properties:

xaml
<Window ...
    xmlns:dxe="http://schemas.devexpress.com/winfx/2008/xaml/editors">
    <StackPanel>
        <StackPanel.Resources>
            <Style x:Key="buttonInfoButtonStyle" TargetType="Button"
                                   BasedOn="{StaticResource {dxet:ButtonsThemeKey ResourceKey=ButtonStyle, ThemeName=Office2019Colorful}}">
                <Setter Property="Width" Value="20" />
                <Setter Property="Height" Value="20" />
                <Style.Triggers>
                    <Trigger Property="IsMouseOver" Value="True">
                        <Setter Property="Background" Value="#FF6200EE" />
                        <Setter Property="BorderThickness" Value="0" />
                        <Setter Property="TextElement.Foreground" Value="White" />
                    </Trigger>
                    <Trigger Property="IsPressed" Value="True">
                        <Setter Property="Background" Value="#FFA46BF5" />
                        <Setter Property="BorderThickness" Value="0" />
                        <Setter Property="TextElement.Foreground" Value="White" />
                    </Trigger>
                </Style.Triggers>
            </Style>
            <Style x:Key="imageButtonInfoButtonStyle" TargetType="Button"
                                   BasedOn="{StaticResource {dxet:ButtonsThemeKey ResourceKey=ImageButtonStyle, ThemeName=Office2019Colorful}}">
                <Setter Property="Width" Value="20" />
                <Setter Property="Height" Value="20" />
                <Style.Triggers>
                    <Trigger Property="IsMouseOver" Value="True">
                        <Setter Property="Background" Value="#FF6200EE" />
                        <Setter Property="BorderThickness" Value="0" />
                        <Setter Property="TextElement.Foreground" Value="White" />
                    </Trigger>
                    <Trigger Property="IsPressed" Value="True">
                        <Setter Property="Background" Value="#FFA46BF5" />
                        <Setter Property="BorderThickness" Value="0" />
                        <Setter Property="TextElement.Foreground" Value="White" />
                    </Trigger>
                </Style.Triggers>
            </Style>
            <Style x:Key="glyphStyle" TargetType="Image">
                <Setter Property="Width" Value="14" />
                <Setter Property="Height" Value="14" />
            </Style>
        </StackPanel.Resources>
        <dxe:ButtonEdit Margin="5" Padding="2,4"
                        BorderThickness="2" EditValue="Custom Appearance"
                        CornerRadius="14" AllowDefaultButton="False"
                        dxe:EditorAppearanceProperties.FocusedBorderBrush="#FF6200EE">
            <dxe:ButtonEdit.Buttons>
                <dxe:ImageButtonInfo CornerRadius="10" Background="Transparent"
                                     BorderThickness="1" BorderBrush="#FF777777"
                                     Foreground="#FF777777" Margin="4,2,2,2"
                                     IsLeft="True" Glyph="Home.svg"
                                     GlyphStyle="{StaticResource glyphStyle}"
                                     ButtonStyle="{StaticResource imageButtonInfoButtonStyle}" />
                <dxe:ButtonInfo CornerRadius="10" Background="PaleGoldenrod"
                                BorderThickness="1" BorderBrush="#FF777777"
                                Foreground="#FF777777" Margin="2,2,4,2"
                                GlyphKind="Plus"
                                ButtonStyle="{StaticResource buttonInfoButtonStyle}" />
                <dxe:ButtonInfo CornerRadius="10" Background="Transparent"
                                BorderThickness="1" BorderBrush="#FF777777"
                                Foreground="#FF777777" Margin="2,2,4,2"
                                GlyphKind="Minus"
                                ButtonStyle="{StaticResource buttonInfoButtonStyle}" />
            </dxe:ButtonEdit.Buttons>
        </dxe:ButtonEdit>
    </StackPanel>
</Window>

Note

The property is supported in the following DevExpress themes:

Theme FamilyThemes
Windows 11Dark, Light
Windows 10Dark, Light
Office 2019Black, Colorful, Dark Gray, White, HighContrast
Visual Studio 2019Blue, Dark, Light
Office 2016 SEBlack, Colorful, Dark Gray, White
Visual Studio 2017Blue, Dark, Light

See Also

ButtonInfoBase Class

ButtonInfoBase Members

DevExpress.Xpf.Editors Namespace