Is there a known problem with the
RefreshPropertiesAttribute
not being able to force
PropertyGrid
to refresh?
I have a simple form that contains a
PropertyGrid
. I create an object, and give it to
PropertyGrid.SelectedObject
. I see the properties of that object displayed.
I then click a test button that causes the value of one of the object's properties to change. However, the
PropertyGrid
does not refresh to display the new value. Only when I click on the grid cell for that property does it refresh.
I decorated the property with the
RefreshPropertiesAttribute
as follows, but it has no effect.
public class Foo
{
private bool m_Flag;
[RefreshProperties( RefreshProperties.All )]
public bool Flag
{
get { return m_Flag; }
set { m_Flag = value; }
}
}
I created my own
CustomPropertyGrid
class that derives from
PropertyGrid
and overrode
Refresh()
. Thus, I am certain that
Refresh()
is not being called.
public class CustomPropertyGrid : System.Windows.Forms.PropertyGrid
{
public override void Refresh( )
{
base.Refresh();
Debug.WriteLine( "*** Refresh ***" );
}
}
My development environment is:
- Visual Studio 2008
- Target Framework = .NET 2.0
Any suggestions are appreciated.