Skip to content

Commit aa1d2f1

Browse files
JMJM
authored andcommitted
Added ValidationError templates to the SampleApp for the PageSizeRequested and MaxCachedPages
1 parent 60814d8 commit aa1d2f1

1 file changed

Lines changed: 38 additions & 2 deletions

File tree

  • DataPresenter.DataSources.OData/DataPresenter.DataSources.OData.SampleApp

DataPresenter.DataSources.OData/DataPresenter.DataSources.OData.SampleApp/MainWindow.xaml

Lines changed: 38 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,35 @@
6060
<Setter Property="SpinButtonDisplayMode" Value="Always"/>
6161
<Setter Property="SpinIncrement" Value="10"/>
6262
<Setter Property="Mask" Value="9999"/>
63+
<Setter Property="Validation.ErrorTemplate">
64+
<Setter.Value>
65+
<ControlTemplate>
66+
<DockPanel>
67+
<StackPanel Orientation="Horizontal" DockPanel.Dock="Right" VerticalAlignment="Center">
68+
<TextBlock Text="(Valid Range: "
69+
Foreground="Red"
70+
Margin="2,0,0,0"/>
71+
<TextBlock Foreground="Red"
72+
Margin="2,0,0,0"
73+
Text="{Binding ElementName=ErrorAdorner, Path=AdornedElement.ValueConstraint.MinInclusive}"/>
74+
<TextBlock Text=" to "
75+
Foreground="Red"
76+
Margin="2,0,0,0"/>
77+
<TextBlock Foreground="Red"
78+
Margin="2,0,0,0"
79+
Text="{Binding ElementName=ErrorAdorner, Path=AdornedElement.ValueConstraint.MaxInclusive}"/>
80+
<TextBlock Text=")"
81+
Foreground="Red"
82+
Margin="2,0,0,0"/>
83+
</StackPanel>
84+
85+
<Border BorderThickness="1" BorderBrush="Red">
86+
<AdornedElementPlaceholder x:Name="ErrorAdorner"/>
87+
</Border>
88+
</DockPanel>
89+
</ControlTemplate>
90+
</Setter.Value>
91+
</Setter>
6392
</Style>
6493

6594
<Style x:Key="ComboBoxText" TargetType="ComboBox">
@@ -134,7 +163,11 @@
134163

135164
<!-- Page Size Requested -->
136165
<TextBlock Text="PAGE SIZE REQUESTED" Style="{StaticResource HeaderText2}"/>
137-
<igEditors:XamNumericEditor x:Name="numPageSizeRequested" Value="{Binding PageSizeRequested}" ValueType="{x:Type sys:Int32}" Style="{StaticResource NumericEditorText}">
166+
<igEditors:XamNumericEditor x:Name="numPageSizeRequested"
167+
Value="{Binding PageSizeRequested, UpdateSourceTrigger=LostFocus, ValidatesOnDataErrors=True, ValidatesOnExceptions=True}"
168+
ValueType="{x:Type sys:Int32}"
169+
Style="{StaticResource NumericEditorText}">
170+
138171
<igEditors:XamNumericEditor.ValueConstraint>
139172
<igEditors:ValueConstraint MinInclusive="5" MaxInclusive="1000"/>
140173
</igEditors:XamNumericEditor.ValueConstraint>
@@ -143,7 +176,10 @@
143176
<!-- Maximum number of cached pages -->
144177
<Rectangle Width="1" Height="20" Fill="Transparent"/>
145178
<TextBlock Text="MAX # CACHED PAGES" Style="{StaticResource HeaderText2}"/>
146-
<igEditors:XamNumericEditor x:Name="numMaxCachedPages" Value="{Binding MaxCachedPages}" ValueType="{x:Type sys:Int32}" Style="{StaticResource NumericEditorText}">
179+
<igEditors:XamNumericEditor x:Name="numMaxCachedPages"
180+
Value="{Binding MaxCachedPages, UpdateSourceTrigger=LostFocus, ValidatesOnDataErrors=True, ValidatesOnExceptions=True}"
181+
ValueType="{x:Type sys:Int32}"
182+
Style="{StaticResource NumericEditorText}">
147183
<igEditors:XamNumericEditor.ValueConstraint>
148184
<igEditors:ValueConstraint MinInclusive="5" MaxInclusive="1000"/>
149185
</igEditors:XamNumericEditor.ValueConstraint>

0 commit comments

Comments
 (0)