示例#1
0
        public void Update(object target)
        {
            PropertyInfo property = target.GetType().GetProperty(targetName);

            if (property == null)
            {
                return;
            }

            object    value    = source;
            IBindable bindable = source as IBindable;

            if (bindable != null)
            {
                value = bindable.GetValue();
            }

            if (property.PropertyType.IsAssignableFrom(value.GetType()))
            {
                property.SetValue(target, value, null);
            }
            else if (property.PropertyType == typeof(string))
            {
                property.SetValue(target, value.ToString(), null);
            }
        }