public static object ReadLocalValue (INativeDependencyObjectWrapper wrapper, DependencyProperty dp)
{
if (dp == null)
throw new ArgumentNullException ("dp");
IntPtr val = NativeMethods.dependency_object_read_local_value (wrapper.NativeHandle, dp.Native);
if (val == IntPtr.Zero) {
return DependencyProperty.UnsetValue;
} else {
// We can get a style or bindingexpression or something else here
// so the Value* will not always be of type 'DP.PropertyType'.
return Value.ToObject (dp.PropertyType, val);
}
}