Author: mkestner
Date: 2006-09-26 17:24:15 -0400 (Tue, 26 Sep 2006)
New Revision: 65937
Modified:
trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ChangeLog
trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/GridEntry.cs
trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/PropertyGrid.cs
trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/PropertyGridView.cs
Log:
2006-09-26 Mike Kestner <[EMAIL PROTECTED]>
* GridEntry.cs : internal SetParent method.
* PropertyGrid.cs : attach to property changed on the proper
target if we have a hierarchical grid with subobjects. Setup
GridItem.Parent for hierarchical items.
* PropertyGridView.cs : Set value on the correct target for
hierarchical grids. [Fixes #78903]
Modified: trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ChangeLog
===================================================================
--- trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ChangeLog
2006-09-26 21:21:07 UTC (rev 65936)
+++ trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ChangeLog
2006-09-26 21:24:15 UTC (rev 65937)
@@ -1,3 +1,12 @@
+2006-09-26 Mike Kestner <[EMAIL PROTECTED]>
+
+ * GridEntry.cs : internal SetParent method.
+ * PropertyGrid.cs : attach to property changed on the proper
+ target if we have a hierarchical grid with subobjects. Setup
+ GridItem.Parent for hierarchical items.
+ * PropertyGridView.cs : Set value on the correct target for
+ hierarchical grids. [Fixes #78903]
+
2006-09-26 Chris Toshok <[EMAIL PROTECTED]>
* Control.cs (ChildNeedsRecreating): this should return true if
Modified:
trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/GridEntry.cs
===================================================================
--- trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/GridEntry.cs
2006-09-26 21:21:07 UTC (rev 65936)
+++ trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/GridEntry.cs
2006-09-26 21:24:15 UTC (rev 65937)
@@ -162,6 +162,10 @@
}
}
+ internal void SetParent (GridItem parent)
+ {
+ this.parent = parent;
+ }
}
}
Modified:
trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/PropertyGrid.cs
===================================================================
--- trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/PropertyGrid.cs
2006-09-26 21:21:07 UTC (rev 65936)
+++ trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/PropertyGrid.cs
2006-09-26 21:24:15 UTC (rev 65937)
@@ -465,10 +465,18 @@
this.help_description_label.Text =
selected_grid_item.PropertyDescriptor.Description;
current_property_value = value.Value;
- if (oldItem != null &&
oldItem.PropertyDescriptor != null)
-
oldItem.PropertyDescriptor.RemoveValueChanged(SelectedObject, new
EventHandler(HandlePropertyValueChanged));
- if (selected_grid_item.PropertyDescriptor !=
null)
-
selected_grid_item.PropertyDescriptor.AddValueChanged(SelectedObject, new
EventHandler(HandlePropertyValueChanged));
+ if (oldItem != null &&
oldItem.PropertyDescriptor != null) {
+ object target = SelectedObject;
+ if (oldItem.Parent != null)
+ target = oldItem.Parent.Value;
+
oldItem.PropertyDescriptor.RemoveValueChanged(target, new
EventHandler(HandlePropertyValueChanged));
+ }
+ if (selected_grid_item.PropertyDescriptor !=
null) {
+ object target = SelectedObject;
+ if (selected_grid_item.Parent != null)
+ target =
selected_grid_item.Parent.Value;
+
selected_grid_item.PropertyDescriptor.AddValueChanged(target, new
EventHandler(HandlePropertyValueChanged));
+ }
OnSelectedGridItemChanged(new
SelectedGridItemChangedEventArgs( oldItem, selected_grid_item));
}
@@ -945,18 +953,19 @@
grid_items = new GridItemCollection();
foreach (object obj in selected_objects) {
if (obj != null) {
-
PopulateGridItemCollection(obj,grid_items, true);
+
PopulateGridItemCollection(obj,grid_items, true, null);
}
}
}
- private void PopulateGridItemCollection (object obj,
GridItemCollection grid_item_coll, bool recurse) {
+ private void PopulateGridItemCollection (object obj,
GridItemCollection grid_item_coll, bool recurse, GridItem parent_grid_item) {
if (!recurse &&
!TypeDescriptor.GetConverter(obj).GetPropertiesSupported())
return;
PropertyDescriptorCollection properties =
TypeDescriptor.GetProperties(obj);
foreach (PropertyDescriptor property in properties) {
if (property.IsBrowsable) {
GridEntry grid_entry = new
GridEntry(obj, property);
+ grid_entry.SetParent (parent_grid_item);
if (property_sort ==
PropertySort.Alphabetical || !recurse) {
if
(grid_item_coll[property.Name] == null)
grid_item_coll.Add(property.Name,grid_entry);
@@ -967,6 +976,7 @@
GridItem cat_item =
grid_item_coll[category];
if (cat_item == null) {
cat_item = new
CategoryGridEntry(category);
+ (cat_item as
CategoryGridEntry).SetParent (parent_grid_item);
grid_item_coll.Add(category,cat_item);
}
cat_item.GridItems.Add(property.Name,grid_entry);
@@ -974,7 +984,7 @@
if (recurse) {
object propObj =
property.GetValue(obj);
if (propObj != null)
-
PopulateGridItemCollection(propObj,grid_entry.GridItems, false);
+
PopulateGridItemCollection(propObj,grid_entry.GridItems, false, grid_entry);
}
grid_entry.Expanded = false;
}
Modified:
trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/PropertyGridView.cs
===================================================================
---
trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/PropertyGridView.cs
2006-09-26 21:21:07 UTC (rev 65936)
+++
trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/PropertyGridView.cs
2006-09-26 21:24:15 UTC (rev 65937)
@@ -523,7 +523,10 @@
if (this.property_grid.SelectedGridItem != null) {
PropertyDescriptor desc =
property_grid.SelectedGridItem.PropertyDescriptor;
if (desc != null) {
-
desc.SetValue(property_grid.SelectedObject, newVal);
+ object target =
property_grid.SelectedObject;
+ if
(property_grid.SelectedGridItem.Parent != null)
+ target =
property_grid.SelectedGridItem.Parent.Value;
+ desc.SetValue(target, newVal);
}
}
}
_______________________________________________
Mono-patches maillist - [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches