Code development platform for open source projects from the European Union institutions :large_blue_circle: EU Login authentication by SMS will be completely phased out by mid-2025. To see alternatives please check here

Skip to content
Snippets Groups Projects
Commit 1ac1a089 authored by Franz KOBER josef's avatar Franz KOBER josef
Browse files

added validationrule for integer and double values, SIValueConverter for...

added validationrule for integer and double values, SIValueConverter for double values is only called at LostFocus event
parent f1291ae5
No related branches found
No related tags found
No related merge requests found
Showing
with 283 additions and 128 deletions
......@@ -22,7 +22,8 @@ namespace VECTO3GUI.Helper.Converter
return DependencyProperty.UnsetValue;
}
if (!(value is SI)) {
throw new Exception("Can only convert SI types!");
return DependencyProperty.UnsetValue;
//throw new Exception("Can only convert SI types!");
}
var siValue = value as SI;
......
......@@ -19,7 +19,8 @@ namespace VECTO3GUI.Helper
var settings = new JsonSerializerSettings {
Formatting = Formatting.Indented,
DateFormatString = DATE_FORMAT
DateFormatString = DATE_FORMAT,
NullValueHandling = NullValueHandling.Ignore
};
if (resolver != null)
......@@ -36,7 +37,7 @@ namespace VECTO3GUI.Helper
using (var file = File.OpenText(filePath)) {
var serializer = new JsonSerializer();
serializer.DateFormatString = DATE_FORMAT;
serializer.DateFormatString = DATE_FORMAT;
if (resolver != null)
serializer.ContractResolver = resolver;
......
using System;
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Controls;
namespace VECTO3GUI.Helper.Validation
{
public class DoubleValidator : ValidationRule
{
private DoubleValidatorConfig _doubleValidator;
public int MinValue { get; set; }
public int MaxValue { get; set; }
public int Decimals { get; set; }
public DoubleValidator() { }
public DoubleValidatorConfig ValidatorConfig
{
get { return _doubleValidator; }
set
{
_doubleValidator = value;
value?.SetValidator(this);
}
}
public override ValidationResult Validate(object value, CultureInfo cultureInfo)
{
var strValue = value as string;
if (strValue != null) {
double number;
if(!double.TryParse(strValue, NumberStyles.Float, cultureInfo, out number))
return new ValidationResult(false, "Not a valid number!");
if (number < MinValue) {
return new ValidationResult(false, $"Only values greater than or equals to {MinValue} are allowed!");
}
if (MaxValue > MinValue)
{
if (number > MaxValue)
return new ValidationResult(false, $"Only values less than or equals to {MaxValue} are allowed!");
}
}
return ValidationResult.ValidResult;
}
}
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
namespace VECTO3GUI.Helper.Validation
{
public class DoubleValidatorConfig : Freezable
{
private DoubleValidator Validator { get; set; }
public int MinValue
{
get { return (int)GetValue(MinValueProperty); }
set { SetValue(MinValueProperty, value); }
}
public static readonly DependencyProperty MinValueProperty = DependencyProperty.Register(
nameof(MinValue), typeof(int), typeof(DoubleValidatorConfig), new FrameworkPropertyMetadata(MinPropertyChangedCallback));
private static void MinPropertyChangedCallback(DependencyObject d, DependencyPropertyChangedEventArgs e)
{
var doubleValidator = (DoubleValidatorConfig)d;
if (doubleValidator.Validator != null)
doubleValidator.Validator.MinValue = (int)e.NewValue;
}
public int MaxValue
{
get { return (int)GetValue(MaxValueProperty); }
set { SetValue(MaxValueProperty, value); }
}
public static readonly DependencyProperty MaxValueProperty = DependencyProperty.Register(
nameof(MaxValue), typeof(int), typeof(DoubleValidatorConfig), new FrameworkPropertyMetadata(MaxPropertyChangedCallback));
private static void MaxPropertyChangedCallback(DependencyObject d, DependencyPropertyChangedEventArgs e)
{
var doubleValidator = (DoubleValidatorConfig)d;
if (doubleValidator.Validator != null)
doubleValidator.Validator.MaxValue = (int)e.NewValue;
}
public int Decimals
{
get { return (int)GetValue(DecimalsProperty); }
set { SetValue(DecimalsProperty, value); }
}
public static readonly DependencyProperty DecimalsProperty = DependencyProperty.Register(
nameof(Decimals), typeof(int), typeof(DoubleValidatorConfig), new FrameworkPropertyMetadata(DecimalsPropertyChangedCallback));
private static void DecimalsPropertyChangedCallback(DependencyObject d, DependencyPropertyChangedEventArgs e)
{
var doubleValidator = (DoubleValidatorConfig)d;
if (doubleValidator.Validator != null)
doubleValidator.Validator.Decimals = (int)e.NewValue;
}
public void SetValidator(DoubleValidator validator)
{
Validator = validator;
if (validator != null)
{
validator.MaxValue = MaxValue;
validator.MinValue = MinValue;
validator.Decimals = Decimals;
}
}
protected override Freezable CreateInstanceCore()
{
return new DoubleValidatorConfig();
}
}
}
......@@ -2,9 +2,6 @@
using System.Collections.Generic;
using System.Globalization;
using System.Windows.Controls;
using System.Windows.Data;
using VECTO3GUI.ViewModel.Impl;
using VECTO3GUI.Views.CustomControls;
namespace VECTO3GUI.Helper.Validation
{
......@@ -14,13 +11,8 @@ namespace VECTO3GUI.Helper.Validation
public int MinValue { get; set; }
public int MaxValue { get; set; }
public bool ValidateInput { get; set; }
public IntegerValidator()
{
}
public IntegerValidator() {}
public IntegerValidatorConfig ValidatorConfig
{
......@@ -32,76 +24,24 @@ namespace VECTO3GUI.Helper.Validation
}
}
//public override ValidationResult Validate(object value, CultureInfo cultureInfo, BindingExpressionBase owner)
//{
// var validateResult = base.Validate(value, cultureInfo, owner);
// var dataItem = ((IntegerVectoParameterControl)((BindingExpression)owner).DataItem);
// if (dataItem.DataContext is CompleteVehicleBusViewModel) {
// }
// //var exp = ((IntegerVectoParameterControl)((BindingExpression)owner).DataItem).Caption;
// //var t = ((IntegerVectoParameterControl)((BindingExpression)owner).ResolvedSource) .DataContext as CompleteVehicleBusViewModel;
// //t.InputValidationErrors = !validateResult.IsValid;
// return validateResult;
//}
public override ValidationResult Validate(object value, CultureInfo cultureInfo)
{
var strValue = value as string;
int number;
if(!int.TryParse(strValue, out number))
return new ValidationResult(false, "Not a valid integer value!");
if (!ValidateInput)
return ValidationResult.ValidResult;
if (strValue != null) {
int number;
if (!int.TryParse(strValue, out number))
return new ValidationResult(false, "Not a valid integer value!");
if (number < MinValue)
return new ValidationResult(false, $"Only integer values greater than or equals to {MinValue} are allowed!");
if(number > MaxValue)
return new ValidationResult(false, $"Only integer values less than or equals to {MaxValue} are allowed!");
if (number < MinValue)
return new ValidationResult(false, $"Only integer values greater than or equals to {MinValue} are allowed!");
if (MaxValue > MinValue) {
if (number > MaxValue)
return new ValidationResult(false, $"Only integer values less than or equals to {MaxValue} are allowed!");
}
}
return ValidationResult.ValidResult;
}
private void SetPropertyError(bool validationResult, string propertyName)
{
}
//protected void SetChangedProperty(bool changed, [CallerMemberName] string propertyName = "")
//{
// if (!changed)
// {
// if (_changedInput.Contains(propertyName))
// _changedInput.Remove(propertyName);
// }
// else
// {
// if (!_changedInput.Contains(propertyName))
// _changedInput.Add(propertyName);
// }
// UnsavedChanges = _changedInput.Count > 0;
//}
}
}
......@@ -43,23 +43,6 @@ namespace VECTO3GUI.Helper.Validation
integerValidator.Validator.MaxValue = (int)e.NewValue;
}
public bool ValidateInput
{
get { return (bool)GetValue(ValidateInputProperty); }
set { SetValue(ValidateInputProperty, value); }
}
public static readonly DependencyProperty ValidateInputProperty = DependencyProperty.Register(
nameof(ValidateInput), typeof(bool), typeof(IntegerValidatorConfig), new FrameworkPropertyMetadata(ValidateInputPropertyChangedCallback));
private static void ValidateInputPropertyChangedCallback(DependencyObject d, DependencyPropertyChangedEventArgs e)
{
var integerValidator = (IntegerValidatorConfig)d;
if (integerValidator.Validator != null)
integerValidator.Validator.ValidateInput = (bool)e.NewValue;
}
private IntegerValidator Validator { get; set; }
public void SetValidator(IntegerValidator validator)
......
......@@ -177,6 +177,8 @@
<Compile Include="Helper\Converter\SaveButtonLabelConverter.cs" />
<Compile Include="Helper\SerializeHelper.cs" />
<Compile Include="Helper\TextBoxInputRegExBehaviour.cs" />
<Compile Include="Helper\Validation\DoubleValidator.cs" />
<Compile Include="Helper\Validation\DoubleValidatorConfig.cs" />
<Compile Include="Helper\Validation\IntegerValidatorConfig.cs" />
<Compile Include="Helper\Validation\IntegerValidator.cs" />
<Compile Include="Helper\ViewModelBase.cs" />
......
......@@ -159,9 +159,8 @@ namespace VECTO3GUI.ViewModel.Impl
}
}
}
[JsonObject(ItemNullValueHandling = NullValueHandling.Ignore)]
public class JobBody : ObservableObject
{
private string _completedVehicle;
......
......@@ -84,7 +84,7 @@
Value="{Binding AppVersion}" IsEnabled="{Binding IsEditable}" />
<customControls:VectoParameterControl
Caption="DeclaredCd x A 0" CaptionWidthGroup="lblWidth"
Caption="DeclaredCd x A 0" CaptionWidthGroup="vehicleLbl"
Unit="{helper:SIUnit DeclaredCdxA}" UnitWidthGroup="unitWidth"
Value="{Binding DeclaredCdxA, Converter={converter:SIValueConverter}, ConverterParameter=double}"
IsEnabled="{Binding IsEditable}"/>
......
......@@ -10,6 +10,7 @@
xmlns:iconPacks="http://metro.mahapps.com/winfx/xaml/iconpacks"
xmlns:views="clr-namespace:VECTO3GUI.Views"
xmlns:local="clr-namespace:VECTO3GUI.Views.ComponentViews.Declaration"
xmlns:validation="clr-namespace:VECTO3GUI.Helper.Validation"
mc:Ignorable="d"
d:DesignHeight="800" d:DesignWidth="800">
......@@ -197,10 +198,21 @@
<ColumnDefinition SharedSizeGroup="unitWidth"/>
</Grid.ColumnDefinitions>
<TextBlock Grid.Column="0" Text="Aux Heater Power" Margin="0,0,10,0"/>
<TextBox Grid.Column="1" Margin="20,0,0,0"
Text="{Binding AuxHeaterPower, Converter={converter:SIValueConverter}, ConverterParameter=double,
Mode=TwoWay, UpdateSourceTrigger=PropertyChanged, ValidatesOnDataErrors=True, NotifyOnValidationError=True}"/>
<TextBox Grid.Column="1" Margin="20,0,0,0">
<TextBox.Resources>
<validation:IntegerValidatorConfig x:Key="IntValidator" MinValue="0" />
</TextBox.Resources>
<TextBox.Text>
<Binding ValidatesOnDataErrors="True" NotifyOnValidationError="True" Path="AuxHeaterPower"
Converter="{converter:SIValueConverter}" ConverterParameter="int" UpdateSourceTrigger="PropertyChanged">
<Binding.ValidationRules>
<validation:IntegerValidator ValidatorConfig="{StaticResource IntValidator}"/>
</Binding.ValidationRules>
</Binding>
</TextBox.Text>
</TextBox>
<TextBlock Grid.Row="0" Grid.Column="2" Text="{helper:SIUnit AuxHeaterPower}" Margin="5,0,5,0"/>
</Grid>
<!--<customControls:VectoParameterControl
......
......@@ -9,6 +9,7 @@
xmlns:helper="clr-namespace:VECTO3GUI.Helper"
xmlns:converter="clr-namespace:VECTO3GUI.Helper.Converter"
xmlns:i="http://schemas.microsoft.com/expression/2010/interactivity"
xmlns:validation="clr-namespace:VECTO3GUI.Helper.Validation"
mc:Ignorable="d"
d:DesignHeight="800" d:DesignWidth="500">
......@@ -120,6 +121,7 @@
<ColumnDefinition />
<ColumnDefinition SharedSizeGroup="unitWidth"/>
</Grid.ColumnDefinitions>
<TextBlock Grid.Row="0" Grid.Column="0" Text="Registered Class" Margin="0,0,10,0"/>
<ComboBox Grid.Column="1"
Margin="20,0,0,0"
......@@ -144,6 +146,7 @@
<ColumnDefinition />
<ColumnDefinition SharedSizeGroup="unitWidth"/>
</Grid.ColumnDefinitions>
<TextBlock Grid.Row="0" Grid.Column="0" Text="Vehicle Code" Margin="0,0,10,0"/>
<ComboBox Grid.Column="1"
Margin="20,0,0,0"
......@@ -161,23 +164,29 @@
Value="{Binding VehicleCode}"
AllowedValues="{Binding AllowedVehicleCodes}" />-->
<Grid Margin="5">
<Grid.ColumnDefinitions>
<ColumnDefinition SharedSizeGroup="vehicleLbl"/>
<ColumnDefinition />
<ColumnDefinition SharedSizeGroup="unitWidth"/>
</Grid.ColumnDefinitions>
<TextBlock Grid.Column="0" Text="Curb Mass Chassis" Margin="0,0,10,0"/>
<TextBox Grid.Column="1" Margin="20,0,0,0"
Text="{Binding CurbMassChassis, Converter={converter:SIValueConverter}, ConverterParameter=int,
Mode=TwoWay, UpdateSourceTrigger=PropertyChanged, ValidatesOnDataErrors=True, NotifyOnValidationError=True}"/>
<TextBlock Grid.Row="0" Grid.Column="2" Text="{helper:SIUnit CurbMassChassis}" Margin="5,0,5,0"/>
<TextBox Grid.Column="1" Margin="20,0,0,0">
<TextBox.Resources>
<validation:IntegerValidatorConfig x:Key="IntValidator" MinValue="500" />
</TextBox.Resources>
<TextBox.Text>
<Binding ValidatesOnDataErrors="True" NotifyOnValidationError="True" Path="CurbMassChassis"
Converter="{converter:SIValueConverter}" ConverterParameter="int" UpdateSourceTrigger="PropertyChanged">
<Binding.ValidationRules>
<validation:IntegerValidator ValidatorConfig="{StaticResource IntValidator}"/>
</Binding.ValidationRules>
</Binding>
</TextBox.Text>
</TextBox>
<TextBlock Grid.Column="2" Text="{helper:SIUnit CurbMassChassis}" Margin="5,0,5,0"/>
</Grid>
<!--<customControls:VectoParameterControl
Caption="Curb Mass Chassis" Unit="{helper:SIUnit CurbMassChassis}" CaptionWidthGroup="vehicleLbl" UnitWidthGroup="unitWidth"
Value="{Binding CurbMassChassis, Converter={converter:SIValueConverter}, ConverterParameter=int}" />-->
<Grid Margin="5">
<Grid.ColumnDefinitions>
......@@ -185,10 +194,21 @@
<ColumnDefinition />
<ColumnDefinition SharedSizeGroup="unitWidth"/>
</Grid.ColumnDefinitions>
<TextBlock Grid.Column="0" Text="Permissible Maximum Laden Mass" Margin="0,0,10,0"/>
<TextBox Grid.Column="1" Margin="20,0,0,0"
Text="{Binding TechnicalPermissibleMaximumLadenMass, Converter={converter:SIValueConverter}, ConverterParameter=int,
Mode=TwoWay, UpdateSourceTrigger=PropertyChanged, ValidatesOnDataErrors=True, NotifyOnValidationError=True}"/>
<TextBox Grid.Column="1" Margin="20,0,0,0">
<TextBox.Resources>
<validation:IntegerValidatorConfig x:Key="IntValidator" MinValue="3500" />
</TextBox.Resources>
<TextBox.Text>
<Binding ValidatesOnDataErrors="True" NotifyOnValidationError="True" Path="TechnicalPermissibleMaximumLadenMass"
Converter="{converter:SIValueConverter}" ConverterParameter="int" UpdateSourceTrigger="PropertyChanged">
<Binding.ValidationRules>
<validation:IntegerValidator ValidatorConfig="{StaticResource IntValidator}"/>
</Binding.ValidationRules>
</Binding>
</TextBox.Text>
</TextBox>
<TextBlock Grid.Row="0" Grid.Column="2" Text="{helper:SIUnit TechnicalPermissibleMaximumLadenMass}" Margin="5,0,5,0"/>
</Grid>
<!--<customControls:VectoParameterControl
......@@ -227,8 +247,19 @@
<ColumnDefinition SharedSizeGroup="unitWidth"/>
</Grid.ColumnDefinitions>
<TextBlock Grid.Column="0" Text="Passengers Lower Deck" Margin="0,0,10,0"/>
<TextBox Grid.Column="1" Margin="20,0,0,0"
Text="{Binding NumberOfPassengersLowerDeck, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged, ValidatesOnDataErrors=True, NotifyOnValidationError=True}"/>
<TextBox Grid.Column="1" Margin="20,0,0,0">
<TextBox.Resources>
<validation:IntegerValidatorConfig x:Key="IntValidator" MinValue="0" />
</TextBox.Resources>
<TextBox.Text>
<Binding ValidatesOnDataErrors="True" NotifyOnValidationError="True" Path="NumberOfPassengersLowerDeck"
UpdateSourceTrigger="PropertyChanged">
<Binding.ValidationRules>
<validation:IntegerValidator ValidatorConfig="{StaticResource IntValidator}"/>
</Binding.ValidationRules>
</Binding>
</TextBox.Text>
</TextBox>
</Grid>
<!--<customControls:VectoParameterControl
Caption="Passengers Lower Deck" Unit="" CaptionWidthGroup="vehicleLbl" UnitWidthGroup="unitWidth"
......@@ -242,8 +273,18 @@
<ColumnDefinition SharedSizeGroup="unitWidth"/>
</Grid.ColumnDefinitions>
<TextBlock Grid.Column="0" Text="Passengers Upper Deck" Margin="0,0,10,0"/>
<TextBox Grid.Column="1" Margin="20,0,0,0"
Text="{Binding NumberOfPassengersUpperDeck, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged, ValidatesOnDataErrors=True, NotifyOnValidationError=True}"/>
<TextBox Grid.Column="1" Margin="20,0,0,0">
<TextBox.Resources>
<validation:IntegerValidatorConfig x:Key="IntValidator" MinValue="0" />
</TextBox.Resources>
<TextBox.Text>
<Binding ValidatesOnDataErrors="True" NotifyOnValidationError="True" Path="NumberOfPassengersUpperDeck"
UpdateSourceTrigger="PropertyChanged"> <Binding.ValidationRules>
<validation:IntegerValidator ValidatorConfig="{StaticResource IntValidator}"/>
</Binding.ValidationRules>
</Binding>
</TextBox.Text>
</TextBox>
</Grid>
<!--<customControls:VectoParameterControl
Caption="Passengers Upper Deck" Unit="" CaptionWidthGroup="vehicleLbl" UnitWidthGroup="unitWidth"
......@@ -262,10 +303,19 @@
<ColumnDefinition SharedSizeGroup="unitWidth"/>
</Grid.ColumnDefinitions>
<TextBlock Grid.Column="0" Text="Height Integrated Body" Margin="0,0,10,0"/>
<TextBox Grid.Column="1" Margin="20,0,0,0"
Text="{Binding HeightIntegratedBody, Converter={converter:SIValueConverter}, ConverterParameter=double,
Mode=TwoWay, UpdateSourceTrigger=PropertyChanged, ValidatesOnDataErrors=True, NotifyOnValidationError=True}"/>
<TextBox Grid.Column="1" Margin="20,0,0,0">
<TextBox.Resources>
<validation:DoubleValidatorConfig x:Key="DoubleValidator" MinValue="0" />
</TextBox.Resources>
<TextBox.Text>
<Binding ValidatesOnDataErrors="True" NotifyOnValidationError="True" Path="HeightIntegratedBody"
Converter="{converter:SIValueConverter}" ConverterParameter="double3" UpdateSourceTrigger="LostFocus">
<Binding.ValidationRules>
<validation:DoubleValidator ValidatorConfig="{StaticResource DoubleValidator}"/>
</Binding.ValidationRules>
</Binding>
</TextBox.Text>
</TextBox>
<TextBlock Grid.Row="0" Grid.Column="2" Text="{helper:SIUnit HeightIntegratedBody}" Margin="5,0,5,0"/>
</Grid>
<!--<customControls:VectoParameterControl
......@@ -280,9 +330,19 @@
<ColumnDefinition SharedSizeGroup="unitWidth"/>
</Grid.ColumnDefinitions>
<TextBlock Grid.Column="0" Text="Vehicle Length" Margin="0,0,10,0"/>
<TextBox Grid.Column="1" Margin="20,0,0,0"
Text="{Binding VehicleLength, Converter={converter:SIValueConverter}, ConverterParameter=double,
Mode=TwoWay, UpdateSourceTrigger=PropertyChanged, ValidatesOnDataErrors=True, NotifyOnValidationError=True}"/>
<TextBox Grid.Column="1" Margin="20,0,0,0">
<TextBox.Resources>
<validation:DoubleValidatorConfig x:Key="DoubleValidator" MinValue="0" Decimals="3" />
</TextBox.Resources>
<TextBox.Text>
<Binding ValidatesOnDataErrors="True" NotifyOnValidationError="True" Path="VehicleLength"
Converter="{converter:SIValueConverter}" ConverterParameter="double3" UpdateSourceTrigger="LostFocus">
<Binding.ValidationRules>
<validation:DoubleValidator ValidatorConfig="{StaticResource DoubleValidator}"/>
</Binding.ValidationRules>
</Binding>
</TextBox.Text>
</TextBox>
<TextBlock Grid.Row="0" Grid.Column="2" Text="{helper:SIUnit VehicleLength}" Margin="5,0,5,0"/>
</Grid>
<!--<customControls:VectoParameterControl
......@@ -297,9 +357,20 @@
<ColumnDefinition SharedSizeGroup="unitWidth"/>
</Grid.ColumnDefinitions>
<TextBlock Grid.Column="0" Text="Vehicle Width" Margin="0,0,10,0"/>
<TextBox Grid.Column="1" Margin="20,0,0,0"
Text="{Binding VehicleWidth, Converter={converter:SIValueConverter}, ConverterParameter=double,
Mode=TwoWay, UpdateSourceTrigger=PropertyChanged, ValidatesOnDataErrors=True, NotifyOnValidationError=True}"/>
<TextBox Grid.Column="1" Margin="20,0,0,0">
<TextBox.Resources>
<validation:DoubleValidatorConfig x:Key="DoubleValidator" MinValue="0" Decimals="3" />
</TextBox.Resources>
<TextBox.Text>
<Binding ValidatesOnDataErrors="True" NotifyOnValidationError="True" Path="VehicleWidth"
Converter="{converter:SIValueConverter}" ConverterParameter="double3" UpdateSourceTrigger="LostFocus">
<Binding.ValidationRules>
<validation:DoubleValidator ValidatorConfig="{StaticResource DoubleValidator}"/>
</Binding.ValidationRules>
</Binding>
</TextBox.Text>
</TextBox>
<TextBlock Grid.Row="0" Grid.Column="2" Text="{helper:SIUnit VehicleWidth}" Margin="5,0,5,0"/>
</Grid>
<!--<customControls:VectoParameterControl
......@@ -314,11 +385,28 @@
<ColumnDefinition SharedSizeGroup="unitWidth"/>
</Grid.ColumnDefinitions>
<TextBlock Grid.Column="0" Text="Entrance Height" Margin="0,0,10,0"/>
<TextBox Grid.Column="1" Margin="20,0,0,0"
<TextBox Grid.Column="1" Margin="20,0,0,0">
<TextBox.Resources>
<validation:DoubleValidatorConfig x:Key="DoubleValidator" MinValue="0" Decimals="3" />
</TextBox.Resources>
<TextBox.Text>
<Binding ValidatesOnDataErrors="True" NotifyOnValidationError="True" Path="EntranceHeight"
Converter="{converter:SIValueConverter}" ConverterParameter="double3" UpdateSourceTrigger="LostFocus">
<Binding.ValidationRules>
<validation:DoubleValidator ValidatorConfig="{StaticResource DoubleValidator}"/>
</Binding.ValidationRules>
</Binding>
</TextBox.Text>
</TextBox>
<!--<TextBox Grid.Column="1" Margin="20,0,0,0"
Text="{Binding EntranceHeight, Converter={converter:SIValueConverter}, ConverterParameter=double,
Mode=TwoWay, UpdateSourceTrigger=PropertyChanged, ValidatesOnDataErrors=True, NotifyOnValidationError=True}"/>
Mode=TwoWay, UpdateSourceTrigger=PropertyChanged, ValidatesOnDataErrors=True, NotifyOnValidationError=True}"/>-->
<TextBlock Grid.Row="0" Grid.Column="2" Text="{helper:SIUnit EntranceHeight}" Margin="5,0,5,0"/>
</Grid>
<!--<customControls:VectoParameterControl
Caption="Entrance Height" Unit="{helper:SIUnit EntranceHeight}" CaptionWidthGroup="vehicleLbl" UnitWidthGroup="unitWidth"
Value="{Binding EntranceHeight, Converter={converter:SIValueConverter}, ConverterParameter=double}" />-->
......
......@@ -21,7 +21,7 @@
<TextBlock Grid.Row="0" Grid.Column="0" Margin="0,0,10,0" Text="{Binding Caption}" />
<TextBox Grid.Row="0" Grid.Column="1" Margin="20,0,0,0" TextAlignment="{Binding ValueAlign}" x:Name="txtName" >
<TextBox.Resources>
<validation:IntegerValidatorConfig x:Key="IntValidator" MinValue="{Binding MinValue}" MaxValue="{Binding MaxValue}" ValidateInput="{Binding ValidateInput}"/>
<validation:IntegerValidatorConfig x:Key="IntValidator" MinValue="{Binding MinValue}" MaxValue="{Binding MaxValue}"/>
</TextBox.Resources>
<!--http://geekswithblogs.net/NewThingsILearned/archive/2008/01/15/binding-to-an-attached-property.aspx-->
<TextBox.Text >
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment