Ejemplo n.º 1
0
        private static void CopyProperty <T>(T t, ConnectionAttribute a, Control c) where T : new()
        {
            PropertyInfo piSource = RetrieveSourceProperty(a, c);
            PropertyInfo piTarget = RetrieveTargetProperty <T>(t, a);

            Object          val = piSource.GetGetMethod().Invoke(c, new Object[] { });
            Type            vct = a.ValueConverter;
            ConstructorInfo ci  = vct.GetConstructor(new Type[] { });
            IValueConverter vc  = (IValueConverter)ci.Invoke(new Object[] { });

            val = vc.ConvertForDataItem(val);

            piTarget.GetSetMethod().Invoke(t, new Object[] { val });
        }