Ejemplo n.º 1
0
        /// <summary>
        /// Executes the action.
        /// </summary>
        protected override void Invoke()
        {
            if (TargetObject == null)
            {
                throw new ArgumentException("No TargetObject provided");
            }
            if (PropertyPath == null)
            {
                throw new ArgumentException("No PropertyPath provided");
            }

            if (this.property == null)
            {
                this.property = ResolveProperty();
            }

            var value = TypeConversionHelper.TryConvert(property.PropertyType, Value, Culture);
            var owner = PropertyPathHelper.GetOwner(TargetObject, PropertyPath);

            if (owner != null) // a sub property can be null if not instantied
            {
                property.SetValue(owner, value);
            }
        }