Posted 14 years ago
by SledgeHammer01
Version: 10.1.0523
Platform: .NET 4.0
Environment: Windows XP (32-bit)
I have a window with a property grid. All stock, no theming, no special code, no event handlers, etc.
I have the following class:I set propGrid.SelectedObject = new Test();
You'll notice that all three properties "force" certain values in the setter.
A: this is an edit box, and no matter what I put in that edit box, once I "accept it", it'll return to 5. Works correctly.
B: this is a bool with the checkbox editor. No matter how I try to click on the checkbox, it always stays turned off. Works correctly.
C: this a bool with the combobox editor. If I select True in the drop down and close, my setter gets called which sets the value to false, and then the getter is called which reads out a false as expected, BUT, the combobox still displays "True". <-- BUG.
[Modified at 09/07/2010 07:05 PM]
I have the following class:
class Test : INotifyPropertyChanged
{
private int _a = 5;
private bool _b = false;
private bool _c = false;
public int A
{
get
{
return _a;
}
set
{
if (value != _a)
{
_a = 5;
FirePropertyChangeNotification("A");
}
}
}
public bool B
{
get
{
return _b;
}
set
{
if (value != _b)
{
_b = false;
FirePropertyChangeNotification("B");
}
}
}
[Editor(typeof(ComboBoxPropertyEditor), typeof(PropertyEditor))]
public bool C
{
get
{
return _c;
}
set
{
if (value != _c)
{
_c = false;
FirePropertyChangeNotification("C");
}
}
}
private void FirePropertyChangeNotification(String PropertyName)
{
if ((object)PropertyChanged != null)
PropertyChanged(this, new PropertyChangedEventArgs(PropertyName));
}
#region INotifyPropertyChanged Members
public event PropertyChangedEventHandler PropertyChanged;
#endregion
}
You'll notice that all three properties "force" certain values in the setter.
A: this is an edit box, and no matter what I put in that edit box, once I "accept it", it'll return to 5. Works correctly.
B: this is a bool with the checkbox editor. No matter how I try to click on the checkbox, it always stays turned off. Works correctly.
C: this a bool with the combobox editor. If I select True in the drop down and close, my setter gets called which sets the value to false, and then the getter is called which reads out a false as expected, BUT, the combobox still displays "True". <-- BUG.
[Modified at 09/07/2010 07:05 PM]