c# - wpf Dependency property before changing event? -


I have dependency property on a control which is a custom class.

Now there is an incident before the price is being changed being raised?

I know that OnPropertyChanged has raised the property has already changed.

I need an event before so that I can cancel the cancellation. ... to preserve the control situation ...

I can not keep the dependency property back in my old values ​​because it would mean that I lose the state under control.

> Thank you! You can use your DependencyProperty to validate the text "itemprop =" lesson ">

after

The incoming value and reject it, if it is not in accordance with your wishes

In the following example, only gives importance to more than 0 will be accepted:

  public integer Test {{return (int) getValue (TestProperty); } Set {set value (testproperty, value); }} Public static Read Only DependencyProperty TestProperty = DependencyProperty.Register ("test", typeof (integer), typeof (YourClass), new UIPropertyMetadata (0), representative (object v) {return (int) v) & gt; ;; / / Here you can see the price set dp});  

Comments

Popular posts from this blog

c# - sqlDecimal to decimal clr stored procedure Unable to cast object of type 'System.Data.SqlTypes.SqlDecimal' to type 'System.IConvertible' -

Calling GetGUIThreadInfo from Outlook VBA -

Obfuscating Python code? -