Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dependency Properties #5

Open
jarnmo opened this issue Dec 12, 2014 · 1 comment
Open

Dependency Properties #5

jarnmo opened this issue Dec 12, 2014 · 1 comment

Comments

@jarnmo
Copy link
Contributor

jarnmo commented Dec 12, 2014

Feel free to comment and discuss Dependency Properties here.

What are they good or bad for? Good practices in using them? What kind of issue have you run into? What are the alternatives?

Any thoughts are welcome!

@jarnmo
Copy link
Contributor Author

jarnmo commented Dec 12, 2014

So, afaik, Dependency Properties are the only way to make properties that can be bound To. My main problems with them are that they require a bit of boiler plate code (although VS 'propdp'-snippet helps a lot), rely on string matching, and the definition is easy to get wrong, in which case you'll only get a runtime exception. There's also no good way to make a dependency property read only, although I'm not even sure there's a situation you'd really need to do that anyway.

Usage wise, I think it's problematic that it's not explicit which properties are Dependency Properties and which are not. You can always check if the DependencyObject has the static [PropertyName]DependencyProperty defined, and at least VS designer let's you know if you try to bind to a property that is not a Dependency Property, but still, doesn't seem ideal to me.

But then again, I'm not aware of an alternative way to implement bindable To properties.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant