private void PropertiesPanel_VisibleChanged(object sender, EventArgs e)
{
if (!this.Visible)
return;
// There is a strange bug that makes one tool button of the
// PropertiesGrid dissapear after an object was assigned while the
// grid was hidden from sight. Following code is a quick hack that
// helps to reset control's toolbar after it becomes visible again.
// TODO: remove this after the root of the problem is found
// and fixed.
if (propertiesGrid.SelectedObjects == null && propertiesGrid.SelectedObject == null)
return;
System.Windows.Forms.Design.PropertyTab tab = propertiesGrid.SelectedTab;
if (propertiesGrid.SelectedObjects != null)
{
object[] objs = propertiesGrid.SelectedObjects;
propertiesGrid.SelectedObjects = null;
propertiesGrid.SelectedObjects = objs;
}
else if (propertiesGrid.SelectedObject != null)
{
object o = propertiesGrid.SelectedObject;
propertiesGrid.SelectedObject = null;
propertiesGrid.SelectedObject = o;
}
if (tab != null)
SelectTabInPropertyGrid(tab.TabName);
}