Does anyone know how to determine if the value of a WPF property is inherited? In particular, I'm trying to determine if the DataContext of a FrameworkElement was inherited from the parent or set directly on the element itself.
DependencyPropertyHelper.GetValueSource will give you a ValueSource, which includes a property for retrieving the BaseValueSource. The BaseValueSource enumeration tells you where the DependencyProperty is getting its value from, such as inherited from parent, set via a style or set locally.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With