public override object ProvideValue(IServiceProvider serviceProvider) { if (!string.IsNullOrEmpty(this.PropertyName)) { object rootTemplatedActivity = ActivityWithResultConverter.GetRootTemplatedActivity(serviceProvider); if (rootTemplatedActivity != null) { PropertyDescriptor descriptor = TypeDescriptor.GetProperties(rootTemplatedActivity)[this.PropertyName]; if (descriptor != null) { return(descriptor.GetValue(rootTemplatedActivity)); } } } throw FxTrace.Exception.AsError(new InvalidOperationException(System.Activities.SR.PropertyReferenceNotFound(this.PropertyName))); }
public override object ProvideValue(IServiceProvider serviceProvider) { if (!string.IsNullOrEmpty(this.PropertyName)) { object targetObject = ActivityWithResultConverter.GetRootTemplatedActivity(serviceProvider); if (targetObject != null) { PropertyDescriptor property = TypeDescriptor.GetProperties(targetObject)[PropertyName]; if (property != null) { return(property.GetValue(targetObject)); } } } throw FxTrace.Exception.AsError( new InvalidOperationException(SR.PropertyReferenceNotFound(this.PropertyName))); }