WPF Validation in an ElementHost control
- by Jon Mitchell
I've got a WinForms form that contains an ElementHost control (which contains a WPF UserControl) and a Save button.
In the WPF UserControl I've got a text box with some validation on it. Something like this...
<TextBox Name="txtSomething" ToolTip="{Binding ElementName=txtSomething, Path=(Validation.Errors).[0].ErrorContent}">
<Binding NotifyOnValidationError="True" Path="Something">
<Binding.ValidationRules>
<commonWPF:DecimalRangeRule Max="1" Min="0" />
</Binding.ValidationRules>
</Binding>
</TextBox>
This all works fine. What I want to do however, is disable the Save button while the form is in an invalid state.
Any help would be greatly appreciated.