Skip to content

Commit 2943d97

Browse files
authored
Merge pull request #49 from rweldin/master
Add AbstractBaseUpDown MinWidth virtual property
2 parents 7a45f98 + 3e7f547 commit 2943d97

File tree

2 files changed

+21
-10
lines changed

2 files changed

+21
-10
lines changed

source/NumericUpDownLib/Base/AbstractBaseUpDown.cs

Lines changed: 19 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -435,14 +435,25 @@ public byte DisplayLength
435435
{
436436
get { return (byte)GetValue(DisplayLengthProperty); }
437437
set { SetValue(DisplayLengthProperty, value); }
438-
}
439-
440-
/// <summary>
441-
/// Gets/sets whether the textbox portion of the numeric up down control
442-
/// can go grow and shrink with its input or whether it should stay with
443-
/// a fixed width.
444-
/// </summary>
445-
public bool IsDisplayLengthFixed
438+
}
439+
440+
/// <summary>
441+
/// Gets/sets the MinWidth for the control. The width of the textbox portion of
442+
/// the control is expanded to fill the MinWidth value while the width of the
443+
/// UpDown buttons are auto sized.
444+
/// </summary>
445+
public virtual double MinWidth
446+
{
447+
get { return (double)GetValue(MinWidthProperty); }
448+
set { SetValue(MinWidthProperty, value); }
449+
}
450+
451+
/// <summary>
452+
/// Gets/sets whether the textbox portion of the numeric up down control
453+
/// can go grow and shrink with its input or whether it should stay with
454+
/// a fixed width.
455+
/// </summary>
456+
public bool IsDisplayLengthFixed
446457
{
447458
get { return (bool)GetValue(IsDisplayLengthFixedProperty); }
448459
set { SetValue(IsDisplayLengthFixedProperty, value); }

source/NumericUpDownLib/Base/InputBaseUpDown.xaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
<Setter.Value>
1313
<ControlTemplate TargetType="{x:Type local:InputBaseUpDown}">
1414
<Border BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}">
15-
<Grid VerticalAlignment="Top">
15+
<Grid VerticalAlignment="Top" MinWidth="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=MinWidth}">
1616
<Grid.Resources>
1717
<conv:ByteToPlaceHolderStringConverter x:Key="ByteToPlaceHolderStringConverter" />
1818
<conv:BoolToVisibilityPropConverter x:Key="BoolToVisibilityConverter" />
@@ -22,7 +22,7 @@
2222
<RowDefinition Height="Auto" />
2323
</Grid.RowDefinitions>
2424
<Grid.ColumnDefinitions>
25-
<ColumnDefinition Width="Auto" />
25+
<ColumnDefinition Width="*" />
2626
<ColumnDefinition Width="Auto" />
2727
</Grid.ColumnDefinitions>
2828

0 commit comments

Comments
 (0)