コード例 #1
0
 public static void BindPropertyRows(this TableLayoutPanel panel, UserProfile profile)
 {
     foreach (Control control in panel.Controls)
     {
         if (control.Tag != null && control.Tag is PropertyControl.PropertyAndObject)
         {
             PropertyControl.PropertyAndObject pao = (PropertyControl.PropertyAndObject)control.Tag;
             if (pao.PropertyInfo.DeclaringType.IsAssignableFrom(profile.GetType()))
             {
                 pao.Object = profile;
             }
             else if (pao.PropertyInfo.DeclaringType.IsAssignableFrom(profile.Details.GetType()))
             {
                 pao.Object = profile.Details;
             }
         }
     }
     panel.RefreshPropertyRows();
 }