我有一个具有一些属性的类。更改其中一个后,我想做出反应并更改其他属性。此操作应由 UITypeEditor 或 TypeConverter 完成,而不是由类本身中的事件完成。
我不想使用 INotifyPropertyChanged 并在类本身中处理它。
未经测试的示例代码
public class MyEditor : UITypeEditor
{
public override object EditValue(ITypeDescriptorContext context, IServiceProvider provider, object value)
{
// change the other property
}
}
[Editor(typeof(MyEditor), typeof(UITypeEditor))]
class MyClass
{
public string String1 { get; set; }
public string String2 { get; set; }
public string String3 { get; set; }
}
这个 EditValue 只有一个用一个小按钮显示编辑器模式的功能......但我想要一个带有 AfterChange 左右的普通文本框。