Saturday, March 5, 2011

Coercion Value in WPF

Lets see what is the meaning of word coercion before we start,

Coercion ( or ) is the practice of forcing another party to behave in an involuntary manner (whether through action or inaction) by use of threats, intimidation, trickery, or some other form of pressure or force. Such actions are used as leverage, to force the victim to act in the desired way. ...
http://en.wikipedia.org/wiki/Coercion

Here we are setting value of the slider to 500 and setting minimum and maximum value to 0 and 100. As you can see value is beyond Min-Max range of slider control. You would think, either it should throw some error during compile/run time or just return the value. But it returns 100 when you query slider’s value property.

Why does it behave this way? Two reasons,

0 Comments :