Thursday, 15 August 2013

Silverlight - Why to Use Attached Property?

Silverlight - Why to Use Attached Property?

I am studying Silverlight (mainly for Windows Phone Development). I read
Silverlight 2 Unleashed and currently reading Silverlight 4 unleashed. The
latter has a chapter on dependency property. As I got from this chapter is
that dependency object (with dependency properties) is used for UI control
objects to support animation and data binding systems. Ok. That's clear.
Now, as the chapter goes on, the attached property is discussed. The main
reason to use it (as stated in the book as well as on the internet) is to
prevent making subclass and add attached properties to the object in
concern. And since attached properties are already dependency properties,
attached behaviour is added too.
The question now: what do I have to do that? What's wrong with
subclassing? and really, why there is alot of code when dealing with
attached property?

No comments:

Post a Comment