Reputation: 17775
I have several forms with many textboxes/comboboxes, and I would like to have the "Save" button disabled while at least one of the fields are invalid. I've been able to setup some custom ValidationRules, like so (textbox example shown):
<Binding Path="Name">
<Binding.ValidationRules>
<my:TextFieldNotEmpty/>
</Binding.ValidationRules>
</Binding>
My question is: how can I set my form up so that, when even 1 validation rule fails, the "Save" button is not enabled? Is there a standard way of handling a situation (a trigger, perhaps), or is this a place where WPF falls short?
Upvotes: 1
Views: 3362
Reputation: 7031
You might be interested in the BookLibrary sample application of the WPF Application Framework (WAF). It shows how to use validation in WPF and how to control the Save button when validation errors exists.
Upvotes: 1
Reputation: 4297
Look at SignumFramework ErrorSummary class:
http://www.signumframework.com/EntityControls.ashx#ErrorSummary http://signum.codeplex.com/SourceControl/changeset/view/25903#510524
Upvotes: 0