<StackPanel Orientation="Horizontal"> <StackPanel.Resources> <DataTemplate DataType="{x:Type ValidationError}"> <DataTemplate.Resources> <Style TargetType="TextBlock" BasedOn="{StaticResource {x:Type TextBlock}}" /> </DataTemplate.Resources> <TextBlock Text="{Binding ErrorContent}" Foreground="Red" VerticalAlignment="Center" FontWeight="Bold"/> </DataTemplate> </StackPanel.Resources> <TextBox x:Name="MaxProficienciesTextBox" Style="{StaticResource LeftAlignTextBoxStyle}" Margin="0,5,3,5" MaxLength="2" IsEnabled="{Binding IsMaxProficienciesEnabled}" KeyUp="MaxProficienciesTextBox_KeyUp" Loaded="MaxProficienciesTextBox_Loaded"> <TextBox.Resources> <val:BindingProxy x:Key="proxy" Data="{Binding}" /> </TextBox.Resources> <TextBox.Text> <Binding Path="MaxProficiencies" UpdateSourceTrigger="PropertyChanged" ValidatesOnExceptions="True"> <Binding.ValidationRules> <val:MaxProficienciesValidationRule Min="1"> <val:MaxProficienciesValidationRule.Wrapper> <val:MaxProficienciesValidationRuleWrapper SolutionID="{Binding SolutionID}" /> </val:MaxProficienciesValidationRule.Wrapper> </val:MaxProficienciesValidationRule> </Binding.ValidationRules> </Binding> </TextBox.Text> </TextBox> <ContentPresenter Content="{Binding ElementName=MaxProficienciesTextBox, Path=(Validation.Errors)[0].ErrorContent}" /> </StackPanel>
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)