private static DependencyProperty Lookup(Kind declaring_kind, string name, Type property_type, bool create) { DependencyProperty prop; if (!LookupInternal (declaring_kind, name, property_type, create, out prop)) { throw new Exception ( String.Format ("DependencyProperty.Lookup: {0} lacks {1}.", Deployment.Current.Types.KindToType (declaring_kind), name)); } return prop; }
internal DependencyPropertyChangedEventArgs(IntPtr raw) : this() { IntPtr uprop = NativeMethods.property_changed_event_args_get_property(raw); Property = DependencyProperty.Lookup(uprop); if (Property == null) { throw new Exception(string.Format("DependencyPropertyChangedEventArgs.ctor: Couldn't find the managed DependencyProperty corresponding with native {0}/{1}", uprop, NativeMethods.property_changed_event_args_get_id(raw))); } OldValue = Value.ToObject(Property.PropertyType, NativeMethods.property_changed_event_args_get_old_value(raw)); NewValue = Value.ToObject(Property.PropertyType, NativeMethods.property_changed_event_args_get_new_value(raw)); }