private void RectangleAnimationForm_Load(object sender, EventArgs e) { if (AnimatedSetting.Value != null) { this.tbStartRectangle.Text = XmlPropertySetting.SerializeValue(this.Property, AnimatedSetting.Value); this.checkBoxUseCurrentValue.Checked = false; } else { this.checkBoxUseCurrentValue.Checked = true; } if (AnimatedSetting.EndValue != null) { this.tbEndRectangle.Text = XmlPropertySetting.SerializeValue(this.Property, AnimatedSetting.EndValue); } if (AnimatedSetting.Step != null) { //TODO: What if the step is different type? this.tbStepRectangle.Text = AnimatedSetting.Step.Value; } else { this.checkBoxUseCurrentValue.Checked = true; } if (AnimatedSetting.ReverseStep != null) { //TODO: What if the step is different type? this.tbReversedStepRectangle.Text = AnimatedSetting.ReverseStep.Value; } if (AnimatedSetting.ReverseStep == null) { this.checkBoxAutomaticReverse.Checked = true; } }
public static string SerializeValue(RadProperty property, object value) { if (value == null) { return((string)null); } PropertyDescriptor prop = TypeDescriptor.GetProperties(property.OwnerType).Find(property.Name, true); return(prop == null?XmlPropertySetting.ConvertValueToString(TypeDescriptor.GetConverter(property.PropertyType), value, property.FullName) : XmlPropertySetting.SerializeValue(prop, value, property.FullName)); }