public static IndirectProperty <TType> Create(object element, string propertyPath) { try { var path = ReflectionPathResolver.GetProperty(element, propertyPath); return(new IndirectProperty <TType>(path.Item1, path.Item2)); } catch (Exception) { return(null); } }
private void Init() { if (Element == null || PropertyPath == null || ChangedEventPath == null) { _indirectProperty = null; TargetBinding = default(TType); return; } try { if (subscribedDelegate != null) { try { EventProxy.Unsubscribe(subscribedEventElement, subscribedEventInfo, subscribedDelegate); } finally { subscribedDelegate = null; subscribedEventInfo = null; subscribedEventElement = null; } } _indirectProperty = IndirectProperty <TType> .Create(Element, PropertyPath); var evt = ReflectionPathResolver.GetEvent(Element, ChangedEventPath); var dlgt = EventProxy.Subscribe(evt.Item1, evt.Item2, OnProxyChangedEvent); subscribedDelegate = dlgt; subscribedEventInfo = evt.Item2; subscribedEventElement = evt.Item1; TargetBinding = _indirectProperty.Get(); } catch (Exception) { _indirectProperty = null; } }