private void SetAttributeValue(StackPanel panel, string name, object value) { AttributeControl ac = panel.Children.OfType <AttributeControl>().Where(c => c.DisplayName == name).FirstOrDefault(); if (ac != null) { ac.Value = value; } }
private void BindDataPanel(StackPanel p, Type t, object value) { foreach (var prop in t.GetProperties().OrderBy(pr => pr.Name)) { object v = value != null?prop.GetValue(value, null) : null; if (v == null) { var tmp = GetTempManager().GetDefault(prop.PropertyType.FullName); if (tmp != null) { v = tmp.Object; } } var ctl = new AttributeControl(prop.Name, prop.PropertyType, v); ctl.DefineComplextType += ctl_DefineComplextType; p.Children.Add(ctl); } }