My current setup binds the Text
property of my TextBox
to a certain Uri
object. I'd love to use WPF's inbuilt validation to detect invalid URIs, and proceed from there. But this doesn't seem to be working?
I would imagine that it would throw an exception if I entered, e.g., "aaaa" as a URI. Thus, triggering my current setup, which is supposed to detect exceptions like so:
<TextBox Grid.Column="1" Name="txtHouseListFile" DockPanel.Dock="Right" Margin="3">
<TextBox.Text>
<Binding Source="{StaticResource Settings}" Path="Default.HouseListFile" Mode="TwoWay">
<Binding.ValidationRules>
<ExceptionValidationRule />
</Binding.ValidationRules>
</Binding>
</TextBox.Text>
</TextBox>
Then I would imagine I could check the various Validation properties, like so?
Validation.GetHasError(this.txtHouseListFile)
But, this appears to not work. Maybe it doesn't throw exceptions when trying to convert? Or maybe my setup's wrong? Corrections to either would be great.