XamlX
XamlX copied to clipboard
ProvideValueTarget returns incorrect(?) TargetObject when nested markup extension is used on property
As in title. I'm not sure whether it's best to return current result or the owner of the property or null like WPF does[1]. Here is a test demonstrating the situation: https://gist.github.com/miloszkukla/871d2321cc9d038dac936a6030add689
[1] https://docs.microsoft.com/en-us/dotnet/api/system.windows.markup.iprovidevaluetarget?view=netframework-4.8
An example case where the values from IProvideValueTarget are null even if the service is available is if your markup extension is nested within another markup extension, such as a Binding. An implementation that relies on IProvideValueTarget should always check for null values if only for the purpose of throwing a specific exception, if that is your intended design.