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.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
Mageshwaran RPosted Nov 24, 2019, 11:47 AM
Rupali ShindePosted Dec 22, 2015, 12:17 AM
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.
Ravi PatelPosted Dec 21, 2015, 9:43 AM