/// <summary> /// Edits the value of the specified object using the specified service provider and context. /// </summary> /// <param name="context">An <see cref="T:System.ComponentModel.ITypeDescriptorContext" /> that can be used to gain additional context information.</param> /// <param name="provider">A service provider object through which editing services can be obtained.</param> /// <param name="value">The object to edit the value of.</param> /// <returns>The new value of the object. If the value of the object has not changed, this should return the same object it was passed.</returns> public override Object EditValue(ITypeDescriptorContext context, System.IServiceProvider provider, Object value) { if (provider != null && context != null) { if (context.Instance is ZeroitMultiFormatLabel) { this.mflabel = (ZeroitMultiFormatLabel)context.Instance; } if (value is List <TextFormat> ) { List <TextFormat> textformats = (List <TextFormat>)value; foreach (TextFormat textF in textformats) { textF.ExtPropertyChanged -= new ExtPropertyChangedEventHandler(this.mflabel.TextFormatHasChanged); textF.ExtPropertyChanged += new ExtPropertyChangedEventHandler(this.mflabel.TextFormatHasChanged); } } } return(base.EditValue(context, provider, value)); }
/// <summary> /// Edits the value of the specified object using the specified service provider and context. /// </summary> /// <param name="context">An <see cref="T:System.ComponentModel.ITypeDescriptorContext" /> that can be used to gain additional context information.</param> /// <param name="provider">A service provider object through which editing services can be obtained.</param> /// <param name="value">The object to edit the value of.</param> /// <returns>The new value of the object. If the value of the object has not changed, this should return the same object it was passed.</returns> public override object EditValue(ITypeDescriptorContext context, IServiceProvider provider, object value) { if (provider != null && context != null) { if (context.Instance is ZeroitMultiFormatLabel) { this.mflabel = (ZeroitMultiFormatLabel)context.Instance; this.TextFormatNames = mflabel.textFormatNames.ToArray(); if (value is List <CustomText> ) { List <CustomText> customtexts = (List <CustomText>)value; foreach (CustomText ctext in customtexts) { ctext.Data = this.TextFormatNames; ctext.ExtPropertyChanged -= new ExtPropertyChangedEventHandler(this.mflabel.CustomTextHasChanged); ctext.ExtPropertyChanged += new ExtPropertyChangedEventHandler(this.mflabel.CustomTextHasChanged); } } } } return(base.EditValue(context, provider, value)); }