Silverlight: Determines if DataContext is inherited or not.

At runtime in general (like iterating over UIElements), can I determine if a given FrameWorkElement has a set of properties not inherited by the DataContext? I want a list of items where the DataContext has been explicitly set and not inherited from above in the chain. I thought maybe GetBindingExpression () would help, but so far it doesn't. Using Silverlight beta 3.

0


a source to share


1 answer


Sure! Just compare the FrameworkElement Parent DataContext using the equality operator.



This may not help in a situation where the child DataContext is set to the exact same element as the parent, but it will help in most scenarios.

0


a source







All Articles