dependency properties - Silverlight - Why to Use Attached Property? -
i studying silverlight (mainly windows phone development). read silverlight 2 unleashed , reading silverlight 4 unleashed. latter has chapter on dependency property. got chapter dependency object (with dependency properties) used ui control objects support animation , data binding systems. ok. that's clear.
now, chapter goes on, attached property discussed. main reason use (as stated in book on internet) prevent making subclass , add attached properties object in concern. , since attached properties dependency properties, attached behaviour added too.
the question now: have that? what's wrong subclassing? , really, why there alot of code when dealing attached property?
the question now: have that?
let's @ great example - layout.
take grid
class. if wanted support this, every control need have gridrow
, gridcolumn
property. however, attached properties allow attach grid.row
control, in turn allows grid
layout control within properly.
attached properties work in basic way - allow "attach" defines or helps behavioral feature work without changing "something" itself.
Comments
Post a Comment