When do we need to create our own custom dependency property?

StrugglingCoder

I am pretty much new to Silverlight and hence after going through a dozen of articles on dependency properties I am still a bit confused about when do we need to explicitly create our own custom dependency properties? Those technical terms on those articles have confused me a lot. Can anyone explain me the scenario that when do we need to create our own DP when suppose using a textbox . If it is at all for binding only we could easily bind the text to something else in Viewmodel but why do we need a DP to be created on our own? I am bit confused. Please help me with an example.

Martin

As a rule of thumb: You should never need to create any DependencyProperties in your ViewModels.

Explanation: You are using Controls to compose your View from, those Controls need to have DependencyProperties because their values are filled through DataBindings (a DataBinding would not be functioning when the corresponding property is no DP). But the source for that value does not need to be a DP (even if it is TwoWay binding). So your ViewModel can have ordinary Properties.

So only when you are at a point where you create your own custom Controls you will also need to define DependencyProperties inside these controls, otherwise you cannot use DataBinding.

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

How can we create our own custom dropdownButton in flutter?

When should we create our own Java exception classes?

Do we need webhook when our server is interacting with dialogflow?

Why do we use alpine image to create our custom image

Why do we need to create a branch in our forked repository to push our changes and then create a pull request to the upstream repository?

Why would we still need to define our own function comparator

why do we need to create new instence of Icollection type property

Why do we need to update applications on our computer even when they work fine?

Can we create our own date format in Java?

How can we create our own CDN links?

Can we create our own field in doxygen documentation?

Why we need framework to do the Dependency Resolver?

Do we need interfaces for dependency injection?

Do we need dependency injection for Model

Do we need to add interface Runnable in our UML class diagram?

DO we need to bundle our js files at the end of production

When do we need to create an object with "new" and when can we just declare and assign value to it?

When there is dependency between several .java files, do we need to compile them in some order?

When do we need IOptions?

Why do we need property in Python?

Can we write our own iterator in Java?

Can we implement our own materials in JavaFX?

Why use build tools like Autotools when we can just write our own makefiles?

Where do I need to change "Ubuntu" when naming my own custom distribution?

Ethereum/Solidity: Do we need to implement an own "balance"-variable in Contracts?

Why do we need to create an instance of a CFC?

do we need to create index specifically in elasticsearch?

Why do we need to create native query?

Why do we need to create an object in heap?