how can I get this code to trigger a validation as typing occurs (cf when leaving the field). The code below works OK in terms of validation, however it does not work until leaving the field (not as you type).
XAML
<Grid.Resources>
<Style TargetType="{x:Type TextBox}">
<Style.Triggers>
<Trigger Property="Validation.HasError" Value="True">
<Setter
Property="ToolTip"
Value="{Binding RelativeSource={RelativeSource Self},Path=(Validation.Errors)[0].ErrorContent}" />
</Trigger>
</Style.Triggers>
</Style>
.
.
.
<TextBox IsEnabled="{Binding ElementName=ProxyModeRadioButton, Path=IsChecked}"
Width="Auto" Name="ProxyHostTextBox" VerticalAlignment="Center" MinWidth="150" >
<TextBox.Text>
<Binding Path="Proxy" >
<Binding.ValidationRules>
<local:SpecialCharactersRule/>
</Binding.ValidationRules>
</Binding>
</TextBox.Text>
</TextBox>
thanks
try
Note the UpdateSourceTrigger=PropertyChanged in the binding.
UPDATE
As blindmeis stated below, I put the UpdateSourceTrigger in the wrong Binding box.. my mistake. It should go with the TextBox.Text. Sorry about that…