Skip to content

Commit 504e574

Browse files
authored
Fixing TextAlignment for NumericUpDown control (#1540)
1 parent 6ed61a5 commit 504e574

File tree

4 files changed

+139
-69
lines changed

4 files changed

+139
-69
lines changed

MahMaterialDragablzMashUp/Mah.xaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,8 @@
6666
<mdix:DataGridComboBoxColumn Header="Combo" SelectedItemBinding="{Binding EnumValue}" ItemsSource="{Binding Source={StaticResource EnumValues}}"/>
6767
<controls:DataGridNumericUpDownColumn Binding="{Binding IntValue}"
6868
Header="Numeric"
69+
Width="300"
70+
TextAlignment="Center"
6971
Minimum="0"
7072
StringFormat="{}{0} km" />
7173
</DataGrid.Columns>

MahMaterialDragablzMashUp/MahAppsDragablzDemo.csproj

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,16 +2,14 @@
22
<Project Sdk="Microsoft.NET.Sdk.WindowsDesktop">
33
<PropertyGroup>
44
<OutputType>WinExe</OutputType>
5-
<TargetFrameworks>net45</TargetFrameworks>
5+
<TargetFrameworks>net472;netcoreapp3.0</TargetFrameworks>
66
<UseWPF>true</UseWPF>
7-
<ProjectTypeGuids>{60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
87
<SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\</SolutionDir>
98
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
109
<AssemblyTitle>MahMaterialDragablzMashUp</AssemblyTitle>
1110
<Product>MahMaterialDragablzMashUp</Product>
1211
<Copyright>Copyright © 2019</Copyright>
1312
<ExtrasEnableWpfProjectSetup>true</ExtrasEnableWpfProjectSetup>
14-
<Configurations>Debug;Release</Configurations>
1513
<ErrorReport>prompt</ErrorReport>
1614
<Prefer32Bit>true</Prefer32Bit>
1715
</PropertyGroup>

MaterialDesignThemes.MahApps/Themes/MaterialDesignTheme.MahApps.Defaults.xaml

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,4 +12,22 @@
1212

1313
<Style TargetType="{x:Type controls:NumericUpDown}" BasedOn="{StaticResource MaterialDesignNumericUpDown}" />
1414
<Style TargetType="{x:Type controls:RangeSlider}" BasedOn="{StaticResource MaterialDesignRangeSlider}" />
15+
16+
<Style x:Key="MahApps.Styles.NumericUpDown.DataGridColumn"
17+
BasedOn="{StaticResource MaterialDesignNumericUpDown}"
18+
TargetType="{x:Type controls:NumericUpDown}">
19+
<Setter Property="Background" Value="Transparent" />
20+
<Setter Property="BorderThickness" Value="0" />
21+
<Setter Property="HideUpDownButtons" Value="True" />
22+
<Setter Property="MinHeight" Value="0" />
23+
<Setter Property="VerticalAlignment" Value="Top" />
24+
<Setter Property="VerticalContentAlignment" Value="Center" />
25+
</Style>
26+
27+
<Style x:Key="MahApps.Styles.NumericUpDown.DataGridColumnEditing"
28+
BasedOn="{StaticResource MahApps.Styles.NumericUpDown.DataGridColumn}"
29+
TargetType="{x:Type controls:NumericUpDown}">
30+
<Setter Property="Background" Value="{DynamicResource MahApps.Brushes.White}" />
31+
<Setter Property="HideUpDownButtons" Value="False" />
32+
</Style>
1533
</ResourceDictionary>

0 commit comments

Comments
 (0)