Recommended

Skip Navigation LinksHome / Articles / Misc

Misc

+
Page 
Prev
Items Resolution

  • 0 comments  /  aggregated from  house of mirrors  on  Feb 10, 2006 (more than a year ago)   /   original article
    Rob Relyea from the Avalon team has a cool intro to 'attached properties', but sadly he doesn't go into the real fun you can have with attached properties. Basically they let you store data on arbitrary DependencyObjects, but the key is that they provide a callback whenever that data changes. Suddenly, this sealed to the hilt behemoth of an API can be extended.

    My current side project is to create my own set of extensible events and actions, but since EventTrigger and TriggerAction are sealed and give us non-Avalon folks no love, enter attached properties:


    <Rectangle Name='RedRect' Width='100' Height='66.6' Fill='Red'>
    <evt:Triggers.Triggers>
    <evt:PropertyTrigger Trigger='{Binding ElementName=RedRect, Path=IsMouseOver}' Value='True'>
    <evt:SetterAction Property='IsActive' Value='True' Target='{Binding}'/>
    <evt:MethodAction Method='Play' Target='{Binding ElementName=VideoFrame}'/>
    evt:PropertyTrigger>
    evt:Triggers.Triggers>
    Rectangle>


    So Triggers.Triggers is an attached property of a collection of Trigger objects.
    Share



Page 
Prev
Help us make SilverlightShow even better and win a free t-shirt. Whether you'd like to suggest a change in the structure, content organization, section layout or any other aspect of SilverlightShow appearance - we'd love to hear from you! Need a material (article, tutorial, or other) on a specific topic? Let us know and SilverlightShow content authors will work to have that prepared for you. (hide this)