Skip to content

Commit cee8c39

Browse files
committed
Added demo combo boxfor HorizontalContentAlignment binding in demo client apps
1 parent e814e88 commit cee8c39

14 files changed

+196
-14
lines changed

source/Demo/UpDownDemoLib/ViewModels/BaseUpDownViewModel.cs

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ public abstract class BaseUpDownViewModel<T> : UpDownDemoLib.ViewModels.Base.Vie
2020
private bool _IsHexDisplayEnabled = false;
2121
protected string _FormatString = "D";
2222
protected string _NumberStyle = "None";
23+
protected System.Windows.HorizontalAlignment _HzntalContentAlignment = System.Windows.HorizontalAlignment.Left;
2324
#endregion fields
2425

2526
#region CTors
@@ -202,6 +203,21 @@ public string NumberStyle
202203
}
203204
}
204205
#endregion HEX DISPLAY ON/OFF Properties
206+
207+
/// <summary>Get/sets the the Alignment style <see cref="System.Windows.HorizontalAlignment"/> that defines the alignment (left, right, center) of the value display in the textbox portion.</summary>
208+
public System.Windows.HorizontalAlignment HzntalContentAlignment
209+
{
210+
get { return _HzntalContentAlignment; }
211+
set
212+
{
213+
if (_HzntalContentAlignment != value)
214+
{
215+
_HzntalContentAlignment = value;
216+
NotifyPropertyChanged(() => HzntalContentAlignment);
217+
}
218+
}
219+
}
220+
205221
#endregion properties
206222

207223
#region methods

source/Demo/UpDownDemoLib/Views/ByteUpDownDemo.xaml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
Margin="3"
2525
HorizontalAlignment="Left"
2626
VerticalAlignment="Top"
27+
HorizontalContentAlignment="{Binding HzntalContentAlignment}"
2728
DisplayLength="5"
2829
FormatString="{Binding FormatString, Mode=OneWay, UpdateSourceTrigger=PropertyChanged}"
2930
IsDisplayLengthFixed="True"
@@ -163,6 +164,18 @@
163164
IsChecked="{Binding Path=IsHexDisplayEnabled, Mode=TwoWay}"
164165
ToolTip="" />
165166

167+
<ComboBox
168+
Width="120"
169+
Margin="21,0,0,0"
170+
IsEditable="False"
171+
Text="{Binding Path=HzntalContentAlignment, Mode=TwoWay}"
172+
ToolTip="Changes the alignment of the text shown in the textbox portion"
173+
ToolTipService.IsEnabled="True">
174+
<ComboBoxItem>Left</ComboBoxItem>
175+
<ComboBoxItem>Center</ComboBoxItem>
176+
<ComboBoxItem>Right</ComboBoxItem>
177+
<ComboBoxItem>Stretch</ComboBoxItem>
178+
</ComboBox>
166179
</StackPanel>
167180

168181
<StackPanel Margin="0,6,0,0">

source/Demo/UpDownDemoLib/Views/DecimalUpDownDemo.xaml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
Margin="3"
2525
HorizontalAlignment="Left"
2626
VerticalAlignment="Top"
27+
HorizontalContentAlignment="{Binding HzntalContentAlignment}"
2728
DisplayLength="10"
2829
IsDisplayLengthFixed="True"
2930
IsMouseDragEnabled="{Binding ElementName=IsMouseDragEnabledCheckBox, Path=IsChecked}"
@@ -153,6 +154,19 @@
153154
Content="Is Large Step Enabled"
154155
IsChecked="{Binding ElementName=SampleUpDown, Path=IsLargeStepEnabled, Mode=TwoWay}"
155156
ToolTip="Setting this controls whether large step increments can be input via mouse drag or keyboard." />
157+
158+
<ComboBox
159+
Width="120"
160+
Margin="21,0,0,0"
161+
IsEditable="False"
162+
Text="{Binding Path=HzntalContentAlignment, Mode=TwoWay}"
163+
ToolTip="Changes the alignment of the text shown in the textbox portion"
164+
ToolTipService.IsEnabled="True">
165+
<ComboBoxItem>Left</ComboBoxItem>
166+
<ComboBoxItem>Center</ComboBoxItem>
167+
<ComboBoxItem>Right</ComboBoxItem>
168+
<ComboBoxItem>Stretch</ComboBoxItem>
169+
</ComboBox>
156170
</StackPanel>
157171

158172
<StackPanel Margin="0,6,0,0">

source/Demo/UpDownDemoLib/Views/DoubleUpDownDemo.xaml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
Margin="3"
2525
HorizontalAlignment="Left"
2626
VerticalAlignment="Top"
27+
HorizontalContentAlignment="{Binding HzntalContentAlignment}"
2728
DisplayLength="7"
2829
FormatString="F4"
2930
IsDisplayLengthFixed="True"
@@ -154,6 +155,19 @@
154155
Content="Is Large Step Enabled"
155156
IsChecked="{Binding ElementName=SampleUpDown, Path=IsLargeStepEnabled, Mode=TwoWay}"
156157
ToolTip="Setting this controls whether large step increments can be input via mouse drag or keyboard." />
158+
159+
<ComboBox
160+
Width="120"
161+
Margin="21,0,0,0"
162+
IsEditable="False"
163+
Text="{Binding Path=HzntalContentAlignment, Mode=TwoWay}"
164+
ToolTip="Changes the alignment of the text shown in the textbox portion"
165+
ToolTipService.IsEnabled="True">
166+
<ComboBoxItem>Left</ComboBoxItem>
167+
<ComboBoxItem>Center</ComboBoxItem>
168+
<ComboBoxItem>Right</ComboBoxItem>
169+
<ComboBoxItem>Stretch</ComboBoxItem>
170+
</ComboBox>
157171
</StackPanel>
158172

159173
<StackPanel Margin="0,6,0,0">

source/Demo/UpDownDemoLib/Views/FloatUpDownDemo.xaml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
Margin="3"
2525
HorizontalAlignment="Left"
2626
VerticalAlignment="Top"
27+
HorizontalContentAlignment="{Binding HzntalContentAlignment}"
2728
DisplayLength="5"
2829
IsDisplayLengthFixed="True"
2930
IsMouseDragEnabled="{Binding ElementName=IsMouseDragEnabledCheckBox, Path=IsChecked}"
@@ -153,6 +154,19 @@
153154
Content="Is Large Step Enabled"
154155
IsChecked="{Binding ElementName=SampleUpDown, Path=IsLargeStepEnabled, Mode=TwoWay}"
155156
ToolTip="Setting this controls whether large step increments can be input via mouse drag or keyboard." />
157+
158+
<ComboBox
159+
Width="120"
160+
Margin="21,0,0,0"
161+
IsEditable="False"
162+
Text="{Binding Path=HzntalContentAlignment, Mode=TwoWay}"
163+
ToolTip="Changes the alignment of the text shown in the textbox portion"
164+
ToolTipService.IsEnabled="True">
165+
<ComboBoxItem>Left</ComboBoxItem>
166+
<ComboBoxItem>Center</ComboBoxItem>
167+
<ComboBoxItem>Right</ComboBoxItem>
168+
<ComboBoxItem>Stretch</ComboBoxItem>
169+
</ComboBox>
156170
</StackPanel>
157171

158172
<StackPanel Margin="0,6,0,0">

source/Demo/UpDownDemoLib/Views/LongUpDownDemo.xaml

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,16 +24,17 @@
2424
Margin="3"
2525
HorizontalAlignment="Left"
2626
VerticalAlignment="Top"
27+
HorizontalContentAlignment="{Binding HzntalContentAlignment}"
2728
DisplayLength="5"
28-
IsDisplayLengthFixed="True"
2929
FormatString="{Binding FormatString, Mode=OneWay, UpdateSourceTrigger=PropertyChanged}"
30-
NumberStyle="{Binding NumberStyle, Mode=OneWay, UpdateSourceTrigger=PropertyChanged}"
30+
IsDisplayLengthFixed="True"
3131
IsMouseDragEnabled="{Binding ElementName=IsMouseDragEnabledCheckBox, Path=IsChecked}"
3232
IsReadOnly="False"
3333
LargeStepSize="{Binding LargeStepSize, Mode=OneWay, UpdateSourceTrigger=PropertyChanged}"
3434
MaxValue="{Binding MaximumValue}"
3535
MinValue="{Binding MinimumValue}"
3636
MouseWheelAccelaratorKey="{Binding AccelModifierKey, Mode=OneWay, UpdateSourceTrigger=PropertyChanged}"
37+
NumberStyle="{Binding NumberStyle, Mode=OneWay, UpdateSourceTrigger=PropertyChanged}"
3738
StepSize="{Binding StepSize, Mode=OneWay, UpdateSourceTrigger=PropertyChanged}"
3839
ToolTip="{Binding ToolTip, Mode=OneWay, UpdateSourceTrigger=PropertyChanged}"
3940
Value="{Binding Value, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" />
@@ -161,6 +162,19 @@
161162
Content="Is Hex Display Enabled"
162163
IsChecked="{Binding Path=IsHexDisplayEnabled, Mode=TwoWay}"
163164
ToolTip="" />
165+
166+
<ComboBox
167+
Width="120"
168+
Margin="21,0,0,0"
169+
IsEditable="False"
170+
Text="{Binding Path=HzntalContentAlignment, Mode=TwoWay}"
171+
ToolTip="Changes the alignment of the text shown in the textbox portion"
172+
ToolTipService.IsEnabled="True">
173+
<ComboBoxItem>Left</ComboBoxItem>
174+
<ComboBoxItem>Center</ComboBoxItem>
175+
<ComboBoxItem>Right</ComboBoxItem>
176+
<ComboBoxItem>Stretch</ComboBoxItem>
177+
</ComboBox>
164178
</StackPanel>
165179

166180
<StackPanel Margin="0,6,0,0">

source/Demo/UpDownDemoLib/Views/NumericUpDownDemo.xaml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
Margin="3"
2525
HorizontalAlignment="Left"
2626
VerticalAlignment="Top"
27+
HorizontalContentAlignment="{Binding HzntalContentAlignment}"
2728
DisplayLength="5"
2829
FormatString="{Binding FormatString, Mode=OneWay, UpdateSourceTrigger=PropertyChanged}"
2930
IsDisplayLengthFixed="True"
@@ -161,6 +162,19 @@
161162
Content="Is Hex Display Enabled"
162163
IsChecked="{Binding Path=IsHexDisplayEnabled, Mode=TwoWay}"
163164
ToolTip="" />
165+
166+
<ComboBox
167+
Width="120"
168+
Margin="21,0,0,0"
169+
IsEditable="False"
170+
Text="{Binding Path=HzntalContentAlignment, Mode=TwoWay}"
171+
ToolTip="Changes the alignment of the text shown in the textbox portion"
172+
ToolTipService.IsEnabled="True">
173+
<ComboBoxItem>Left</ComboBoxItem>
174+
<ComboBoxItem>Center</ComboBoxItem>
175+
<ComboBoxItem>Right</ComboBoxItem>
176+
<ComboBoxItem>Stretch</ComboBoxItem>
177+
</ComboBox>
164178
</StackPanel>
165179

166180
<StackPanel Margin="0,6,0,0">

source/Demo/UpDownDemoLib/Views/PercentageUpDownDemo.xaml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929
Margin="3"
3030
HorizontalAlignment="Left"
3131
VerticalAlignment="Top"
32+
HorizontalContentAlignment="{Binding HzntalContentAlignment}"
3233
DisplayLength="7"
3334
IsDisplayLengthFixed="True"
3435
IsMouseDragEnabled="{Binding ElementName=IsMouseDragEnabledCheckBox, Path=IsChecked}"
@@ -163,6 +164,19 @@
163164
Content="Is Large Step Enabled"
164165
IsChecked="{Binding ElementName=SampleUpDown, Path=IsLargeStepEnabled, Mode=TwoWay}"
165166
ToolTip="Setting this controls whether large step increments can be input via mouse drag or keyboard." />
167+
168+
<ComboBox
169+
Width="120"
170+
Margin="21,0,0,0"
171+
IsEditable="False"
172+
Text="{Binding Path=HzntalContentAlignment, Mode=TwoWay}"
173+
ToolTip="Changes the alignment of the text shown in the textbox portion"
174+
ToolTipService.IsEnabled="True">
175+
<ComboBoxItem>Left</ComboBoxItem>
176+
<ComboBoxItem>Center</ComboBoxItem>
177+
<ComboBoxItem>Right</ComboBoxItem>
178+
<ComboBoxItem>Stretch</ComboBoxItem>
179+
</ComboBox>
166180
</StackPanel>
167181

168182
<StackPanel Margin="0,6,0,0">

source/Demo/UpDownDemoLib/Views/SByteUpDownDemo.xaml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
Margin="3"
2525
HorizontalAlignment="Left"
2626
VerticalAlignment="Top"
27+
HorizontalContentAlignment="{Binding HzntalContentAlignment}"
2728
DisplayLength="5"
2829
FormatString="{Binding FormatString, Mode=OneWay, UpdateSourceTrigger=PropertyChanged}"
2930
IsDisplayLengthFixed="True"
@@ -162,6 +163,19 @@
162163
Content="Is Hex Display Enabled"
163164
IsChecked="{Binding Path=IsHexDisplayEnabled, Mode=TwoWay}"
164165
ToolTip="" />
166+
167+
<ComboBox
168+
Width="120"
169+
Margin="21,0,0,0"
170+
IsEditable="False"
171+
Text="{Binding Path=HzntalContentAlignment, Mode=TwoWay}"
172+
ToolTip="Changes the alignment of the text shown in the textbox portion"
173+
ToolTipService.IsEnabled="True">
174+
<ComboBoxItem>Left</ComboBoxItem>
175+
<ComboBoxItem>Center</ComboBoxItem>
176+
<ComboBoxItem>Right</ComboBoxItem>
177+
<ComboBoxItem>Stretch</ComboBoxItem>
178+
</ComboBox>
165179
</StackPanel>
166180

167181
<StackPanel Margin="0,6,0,0">

source/Demo/UpDownDemoLib/Views/ShortUpDownDemo.xaml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
Margin="3"
2525
HorizontalAlignment="Left"
2626
VerticalAlignment="Top"
27+
HorizontalContentAlignment="{Binding HzntalContentAlignment}"
2728
DisplayLength="5"
2829
FormatString="{Binding FormatString, Mode=OneWay, UpdateSourceTrigger=PropertyChanged}"
2930
IsDisplayLengthFixed="True"
@@ -162,6 +163,19 @@
162163
Content="Is Hex Display Enabled"
163164
IsChecked="{Binding Path=IsHexDisplayEnabled, Mode=TwoWay}"
164165
ToolTip="" />
166+
167+
<ComboBox
168+
Width="120"
169+
Margin="21,0,0,0"
170+
IsEditable="False"
171+
Text="{Binding Path=HzntalContentAlignment, Mode=TwoWay}"
172+
ToolTip="Changes the alignment of the text shown in the textbox portion"
173+
ToolTipService.IsEnabled="True">
174+
<ComboBoxItem>Left</ComboBoxItem>
175+
<ComboBoxItem>Center</ComboBoxItem>
176+
<ComboBoxItem>Right</ComboBoxItem>
177+
<ComboBoxItem>Stretch</ComboBoxItem>
178+
</ComboBox>
165179
</StackPanel>
166180

167181
<StackPanel Margin="0,6,0,0">

0 commit comments

Comments
 (0)