Files
Gestio-Carros/View/SingleNumericTextBoxView.xaml
2020-11-29 11:05:11 +01:00

36 lines
1.7 KiB
XML

<UserControl x:Class="Mercat_1.SingleNumericTextBoxView"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="clr-namespace:Mercat_1"
mc:Ignorable="d"
d:DesignHeight="450" d:DesignWidth="800">
<UserControl.Resources>
<local:MyDataSource x:Key="Ods"/>
<Style x:Key="errorToolTip" TargetType="Control">
<Style.Triggers>
<Trigger Property="Validation.HasError" Value="True">
<Setter Property="ToolTip"
Value="{
Binding RelativeSource={x:Static RelativeSource.Self},
Path=(Validation.Errors)/ErrorContent}"/>
</Trigger>
</Style.Triggers>
</Style>
<Style TargetType="{x:Type TextBox}" BasedOn="{StaticResource errorToolTip}"/>
</UserControl.Resources>
<Grid>
<TextBox x:Name="age" Height="Auto" Width="Auto"
Margin="5" Grid.Column="1" Grid.Row="1" >
<TextBox.Text>
<Binding Path="zeroval" Source="{StaticResource Ods}" Mode="TwoWay" UpdateSourceTrigger="PropertyChanged">
<Binding.ValidationRules>
<local:NumValidationRule Min="0" Max="9999" />
</Binding.ValidationRules>
</Binding>
</TextBox.Text>
</TextBox>
</Grid>
</UserControl>