I want to have a button's IsEnabled to only be true if two textboxes don't have any errors (in this case, I just want them to both be numeric)
I tried setting the textboxes to NotifyOnValidationError=True, thinking this will raise an exception that bubbles up to a container control - I would then set the Button's IsEnabled to true based on the Validation.HasError attached property belonging to that control
I tried the following (stripped of formatting code) but it's not working (the button is enabled when I first start the application and the textboxes are empty - they are bound to nullable decimals)
<WrapPanel> <TextBox x:Name="txtDeltaMin"Text="{Binding Path=DeltaMinFilter, NotifyOnValidationError=True, ValidatesOnDataErrors=True, ValidatesOnExceptions=True}"></TextBox> <TextBox x:Name="txtDeltaMax" Text="{Binding Path=DeltaMaxFilter, NotifyOnValidationError=True, ValidatesOnDataErrors=True, ValidatesOnExceptions=True}"></TextBox> <Button x:Name="btnUpdateFilter" Click="btnUpdateFilter_Click" IsEnabled="{Binding RelativeSource={RelativeSource Mode=FindAncestor, AncestorType={x:Type WrapPanel}}, Path=(Validation.HasError)}">Filter</Button> </WrapPanel>