More on debugging DependencyProperty

In the previous post on DependencyPropertyHelper, we explored one way of debugging the Dependency Properties. The DepedencyPropertyHelper provides you details on from which value provider the final value was calculated from. However, if you want to trace and ensure the binding has been set correctly, you could make use of PresentationTraceSources. For example, consider following binding. <Button … Continue reading More on debugging DependencyProperty

DependencyPropertyHelper.GetValueSource : Debugging Helper for Dependency Properties

DependencyPropertyHelper.GetValueSource is a great debugging aid in detecting the source of value of a Dependency Property. This is quite useful for WPF developers who might need to figure out the source which provides the current value for the Dependency Property. The DependencyPropertyHelper.GetValueSource returns a structure ValueSource which has 5 Properties. BaseValueSourceIsAnimatedIsCoercedIsCurrentIsExpression DependencyPropertyHelper.GetValueSource(buttonControl,CustomValueProperty) {System.Windows.ValueSource} BaseValueSource: Local IsAnimated: false IsCoerced: false IsCurrent: … Continue reading DependencyPropertyHelper.GetValueSource : Debugging Helper for Dependency Properties

Why be wary of Value Coercion in Dependency Properties

If you are not quite familiar with Value Coercion, it allows you to change/correct value of a property, when it is assigned an unexpected value. This also allows you to ensure relative properties are also kept in sync or in other words, allows you to enforce relation between properties of an object. For example, Date … Continue reading Why be wary of Value Coercion in Dependency Properties