Skip to content

WPF-947138 : Add additional information about styling and brush customization in DomainUpDown documentation #1764

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
110 changes: 110 additions & 0 deletions wpf/Domain-UpDown/Appearance-and-Styling.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,3 +45,113 @@ The AccentBrush property is used to decorate the hot spots of a control with a s

{%endhighlight%}
{% endtabs %}

## Customize Up,Down button Style

We can customize the appearance of the up/down buttons in the [SfDomainUpDown](https://help.syncfusion.com/cr/wpf/Syncfusion.Windows.Controls.Input.SfDomainUpDown.html) control by using the [UpDownStyle](https://help.syncfusion.com/cr/wpf/Syncfusion.Windows.Controls.Input.SfDomainUpDown.html#Syncfusion_Windows_Controls_Input_SfDomainUpDown_UpDownStyle) property.

This property allows you to apply a custom style and template to the internal SfUpDown control, which hosts the up/down buttons.

{% tabs %}
{%highlight xaml%}

<Window xmlns:editors="clr-namespace:Syncfusion.Windows.Controls;assembly=Syncfusion.SfInput.WPF">
<Window.Resources>

<!-- Style for Up/Down Buttons-->
<Style x:Key="CustomUpDownButtonStyle" TargetType="editors:SfUpDown">
<Setter Property="BorderBrush" Value="Black"/>
<Setter Property="FontWeight" Value="Bold"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="editors:SfUpDown">
<Border
BorderBrush="{TemplateBinding BorderBrush}"
BorderThickness="1"
CornerRadius="2">
<Grid x:Name="PART_OuterGrid">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*" />
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="Auto" />
</Grid.ColumnDefinitions>
<ContentControl x:Name="PART_Content" IsTabStop="False" Focusable="False" Content="{TemplateBinding UpDownContent}"
/>
<Button
x:Name="PART_DownButton"
Grid.Column="1"
HorizontalAlignment="Stretch"
VerticalAlignment="Stretch"
Background="{TemplateBinding AccentBrush}"
BorderBrush="{TemplateBinding BorderBrush}"
Foreground="{TemplateBinding Foreground}"
BorderThickness="1"
Padding="5"
FontSize="20"
Command="{TemplateBinding DownCommand}"
IsTabStop="False"
Content="-"
/>
<Button
x:Name="PART_UpButton"
Grid.Column="2"
HorizontalAlignment="Stretch"
VerticalAlignment="Stretch"
Background="{TemplateBinding AccentBrush}"
BorderBrush="{TemplateBinding BorderBrush}"
Foreground="{TemplateBinding Foreground}"
BorderThickness="1"
Padding="5"
FontSize="20"
Command="{TemplateBinding UpCommand}"
Content="+"
IsTabStop="False"
/>
</Grid>
</Border>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>

<!-- Customized SfDomainUpDown Style -->
<Style TargetType="syncfusion:SfDomainUpDown">
<Setter Property="AccentBrush" Value="LightBlue" />
<Setter Property="Foreground" Value="Black" />
<Setter Property="Background" Value="Lavender" />
<Setter Property="BorderBrush" Value="Black" />
<Setter Property="BorderThickness" Value="1" />
<Setter Property="FontSize" Value="15" />
<Setter Property="VerticalContentAlignment" Value="Center" />
<Setter Property="HorizontalAlignment" Value="Center" />
<Setter Property="Padding" Value="3" />
<Setter Property="UpDownStyle" Value="{StaticResource CustomUpDownButtonStyle}"/>
</Style>
</Window.Resources>
<Grid>
<syncfusion:SfDomainUpDown x:Name="DomainUpDown" Height="44" Width="231" ItemsSource="{Binding Employees}">
<syncfusion:SfDomainUpDown.ContentTemplate>
<DataTemplate>
<StackPanel Orientation="Horizontal" HorizontalAlignment="Center" VerticalAlignment="Center">
<TextBlock Text="{Binding Name}" VerticalAlignment="Center" Margin="5"/>
</StackPanel>
</DataTemplate>
</syncfusion:SfDomainUpDown.ContentTemplate>
</syncfusion:SfDomainUpDown>
</Grid>
</Window>

{%endhighlight%}
{% endtabs %}

![UpDown_Button Customization](Appearance-and-Styling_images/UpDown_Button.png)

## Theme

SfDomainUpDown supports various built-in themes. Refer to the below links to apply themes for the SfDomainUpDown,

* [Apply theme using SfSkinManager](https://help.syncfusion.com/wpf/themes/skin-manager)

* [Create a custom theme using ThemeStudio](https://help.syncfusion.com/wpf/themes/theme-studio#creating-custom-theme)

![Setting theme to WPF SfDomainUpDown](Getting-Started_images/SfDomainUpDown_theme_support.png)
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
10 changes: 0 additions & 10 deletions wpf/Domain-UpDown/Getting-Started.md
Original file line number Diff line number Diff line change
Expand Up @@ -237,13 +237,3 @@ domainUpDown1.SpinButtonsAlignment = Syncfusion.Windows.Controls.SpinButtonsAlig
3.Both

![SpinButton aligned both](Getting-Started_images/Spin-Button-Alignment_img5.png)

## Theme

SfDomainUpDown supports various built-in themes. Refer to the below links to apply themes for the SfDomainUpDown,

* [Apply theme using SfSkinManager](https://help.syncfusion.com/wpf/themes/skin-manager)

* [Create a custom theme using ThemeStudio](https://help.syncfusion.com/wpf/themes/theme-studio#creating-custom-theme)

![Setting theme to WPF SfDomainUpDown](Getting-Started_images/SfDomainUpDown_theme_support.png)