Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
DependencyProperty ClearValue
Message
De
17/02/2009 13:46:01
 
 
À
17/02/2009 05:20:36
Information générale
Forum:
ASP.NET
Catégorie:
Windows Presentation Foundation (WPF)
Versions des environnements
Environment:
C# 3.0
Divers
Thread ID:
01381612
Message ID:
01382443
Vues:
32
>>If the answer is yes, then I'm going to have to rethink the rest of this.
>
>Yes. If any element above it in the visual tree is locked then it should be locked. If no element above is locked it should revert to its own locked state.
>
>The docs say that you CAN use DepenendencyProperty.Register() where metadata specifies inheritance but the behaviour is undefined.
>One obvious difference is that with RegisterAttached() callbacks are raised on all elements in the visual tree. Using .Register() this doesn't happen.....
>
>I guess I still have stuff to learn about dependency properties - but I'm more comfortable now than I was a couple of days ago....
>
>Best,
>Viv

OK, now that I fully understand what your doing. Readonly and a second DP do not make sense for this.

Did this end up working?
private static object CoerceIsLocked(DependencyObject d, object value)
        {
            if (d.ReadLocalValue(ContentIsLockedProperty) == DependencyProperty.UnsetValue)
                return value;
            bool b = (bool)value;
            if (b)
                return b;
            else
                return DependencyProperty.UnsetValue;
        }
This is interesting, I'm coding a test project just to play with this. There are so many possible side effects depending on order of execution etc, that I can't think with it in my head.
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform