c# - Dependency Property Call in code behind -
I created custom user controls with some dependency properties.
This custom control is hosted on a window.
When I try to get a value from a DependecyProperty in the code behind it, then it does not work. Public static read-only dependency property ValueDp = DependencyProperty.Register ("value", typef (string), typef (microprogram user control), New Framework Property Metatata (string. Api, output handler)); Public string value {get {return (string) GetValue (ValueDp); } Set {Set Value (ValueDp, Value); }} Private Static Zero Output Handler (Dependency Object Dependency Object, Associations on Dependency Properties, Dependency Project, Event Arguments) {var temp = Dependency Object MyCustomUserControl; If (temp! = Null) {dependency object.setValue (ValueDp, temp._conversionValue); }}
I have put a button on the host and when I click on it, I want to read the value stored in the DP, but I will always get the default value in the DP.
Any thoughts that I'm doing wrong here?
Regards
I think the output handler method You always leave the new value assigned to property (
dependencyPropertyChangedEventArgs.NewValue )
Comments
Post a Comment