I want to use the ValidationRules (and it's UI effects) on the textbox without actually binding anything to the textbox.
I want to use the textbox for some input that doesn't bound to anything but need to validate the input after focus is lost using the ValidationRules.
Can it be done?
<TextBox.Text>
<Binding Path="" UpdateSourceTrigger="LostFocus">
<Binding.ValidationRules>
<local:IntegersOnlyValidator/>
</Binding.ValidationRules>
</Binding>
</TextBox.Text>
This worked for me:
<TextBox.Text>
<Binding RelativeSource="{RelativeSource Self}" Path="Text" UpdateSourceTrigger="LostFocus">
<Binding.ValidationRules>
<Filters:IntegersOnlyValidator/>
</Binding.ValidationRules>
</Binding>
</TextBox.Text>