Browse Source

2008-02-29 Ivan N. Zlatev <[email protected]>

	* PropertyGrid.cs: Fix wrong array size initialization.
	* GridEntry.cs: For MS compitability make all child properties 
	readonly if the parent is readonly. Ugh.
	[Fixes bug #365945 and #365944]


svn path=/trunk/mcs/; revision=97011
Ivan Zlatev 18 years ago
parent
commit
cb731a9cb4

+ 8 - 0
mcs/class/Managed.Windows.Forms/System.Windows.Forms/ChangeLog

@@ -1,3 +1,11 @@
+2008-02-29  Ivan N. Zlatev  <[email protected]>
+
+	* PropertyGrid.cs: Check for null PropertyDescriptor.Name just 
+	in case.
+	* GridEntry.cs: For MS compitability make all child properties 
+	readonly if the parent is readonly. Ugh.
+	[Fixes bug #365945 and #365944]
+
 2008-02-29  Andreia Gaita <[email protected]> 
 
 	* HtmlHistory.cs: Fix sigs for Forward and Back to navigate by index

+ 4 - 1
mcs/class/Managed.Windows.Forms/System.Windows.Forms/GridEntry.cs

@@ -588,7 +588,10 @@ namespace System.Windows.Forms.PropertyGridInternal
 				// 	Console.WriteLine ("CanConvertFrom (string): " + PropertyDescriptor.Converter.CanConvertFrom ((ITypeDescriptorContext)this, typeof (string)));
 				// 	Console.WriteLine ("IsArray: " + PropertyDescriptor.PropertyType.IsArray.ToString ());
 				// }
-				if (PropertyDescriptor == null || PropertyOwner == null ||
+				if (ParentEntry != null && ParentEntry.GridItemType == GridItemType.Property 
+				    && ParentEntry.IsReadOnly)
+					return true;
+				else if (PropertyDescriptor == null || PropertyOwner == null ||
 				    (PropertyDescriptor.IsReadOnly && !this.ShouldCreateParentInstance))
 					return true;
 				else if (!HasCustomEditor && PropertyDescriptor.Converter == null)

+ 14 - 14
mcs/class/Managed.Windows.Forms/System.Windows.Forms/PropertyGrid.cs

@@ -990,8 +990,9 @@ namespace System.Windows.Forms {
 			base.OnMouseUp (e);
 		}
 		
-		[MonoTODO]
-		protected void OnNotifyPropertyValueUIItemsChanged(object sender, EventArgs e) {
+		protected void OnNotifyPropertyValueUIItemsChanged(object sender, EventArgs e) 
+		{
+			property_grid_view.UpdateView ();
 		}
 
 		protected override void OnPaint (PaintEventArgs pevent) {
@@ -1401,7 +1402,7 @@ namespace System.Windows.Forms {
 			}
 		}
 		
-		internal void UpdateToolBarButtons ()
+		private void UpdateToolBarButtons ()
 		{
 			if ((PropertySort & PropertySort.Categorized) != 0) {
 				categorized_toolbarbutton.Pushed = true;
@@ -1531,8 +1532,7 @@ namespace System.Windows.Forms {
 
 			foreach (string propertyName in propertyNames) {
 				GridEntry item = null;
-
-				PropertyDescriptor[] properties = new PropertyDescriptor[propertyNames.Length];
+				PropertyDescriptor[] properties = new PropertyDescriptor[propertyOwners.Length];
 				for (int i=0; i < propertyOwners.Length; i++)
 					properties[i] = GetPropertyDescriptor (propertyOwners[i], propertyName);
 
@@ -1703,15 +1703,15 @@ namespace System.Windows.Forms {
 		{
 		
 #if NET_2_0
-		public bool Pushed {
-			get { return base.Checked; }
-			set { base.Checked = value; }
-		}
-		
-		public ToolBarButtonStyle Style {
-			get { return ToolBarButtonStyle.PushButton; }
-			set { }
-		}
+			public bool Pushed {
+				get { return base.Checked; }
+				set { base.Checked = value; }
+			}
+			
+			public ToolBarButtonStyle Style {
+				get { return ToolBarButtonStyle.PushButton; }
+				set { }
+			}
 #endif
 		}