what is the custom Dependency Property? need an example.
also what is the difference between Dependency property and Attached property in WPF.
Know the answer? Post it. Somebody with the same question will find it here.
Answer a question in the forums and earn +20 SHARP for every answer.
See unanswered questions
DevSocialUpcoming · 3rd editionAI Agents ConferenceDec 1–3, 2026Live onlineFree to attend5days leftRegister
Ravi PatelRank #439 · 5.7K reputationPosted Dec 21, 2015, 4:43 AM EST
Rupali ShindeRank #539 · 4.5K reputationPosted Dec 21, 2015, 7:17 PM EST
Dependency Property is a broad concept explaining which might take couple of pages to write. So just to answer your question. Dependancy property is used where
You know the property is going to be the binding target i.e your are creating your usercontrol/custom control and want property that should be binding driven.
You want automatic property change notifications (coerse and validation also).
We want value inheritance in styles,themes, parent or default value.
There is not need to create the properties on Model or ViewModel layer as dependency properties most of the time as that is not going to help much on memory saving front as most of the properties we define in model/VM will have values per instance as they will be constantly changing. Resolving Dependency property value is a burden in itself so making property dependency unneccessarily is not advisable.
Mageshwaran RRank #411 · 6.1K reputationPosted Nov 24, 2019, 6:47 AM EST