views:

147

answers:

3

Greetings, how can I validate if value in TextBlock is ok? I have a TextBox where I bind "Amount" property and a TextBlock which uses Multibinding: Price Property and Amount property. I would like to do something like that: In case of changing Amount i would like to validate if the price is greater than xx (which is the constant). Thanks in advance

A: 

You have create validation rule class(derived from validation rule) for binding validation. Here is some sample to how to implement binding validation in WPF

Sample 1

Sample 2

Firoz
A: 

i know how to create validation rules. I just want to fire validation in my TextBlock when the value in other control (TextBox) changes.

Peter
This is not really an answer, it's more of a comment...
Pieter Breed
A: 

There is a simple flag in XAML that sets when to validate.

<'local:ValidationRules ValidatesOnTargetUpdated="True" />

Hope that helps.

Tri Q