3
我有一個具有一些屬性的類。改變其中一人後,我想反應並改變其他屬性。此操作應該由UITypeEditor或TypeConverter完成,而不是由類本身的事件完成。PropertyGrid在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只有在顯示一個小按鈕編輯器模式的功能...但我想有有改動後左右的正常文本框。
屬性網格中的UITypeEditors只支持模態或下拉窗體,您不能使用某種就地TextBox替換網格項的值。請詳細說明你想要做什麼。 – 2012-09-11 11:35:26