2
0
Эх сурвалжийг харах

* ListView.cs: When changing the size in VirtualMode, also Reset the
selection.
* ListViewItem.cs: Don't call SelectedIndexCollection.Reset when
changing selection info for VirtualMode.
Fixes #372618.

2009-04-12 Carlos Alberto Cortez <[email protected]>


svn path=/trunk/mcs/; revision=100538

Carlos Alberto Cortez 18 жил өмнө
parent
commit
d296501ec7

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

@@ -1,3 +1,11 @@
+2009-04-12  Carlos Alberto Cortez <[email protected]>
+
+	* ListView.cs: When changing the size in VirtualMode, also Reset the
+	selection.
+	* ListViewItem.cs: Don't call SelectedIndexCollection.Reset when
+	changing selection info for VirtualMode.
+	Fixes #372618.
+
 2009-04-12  Carlos Alberto Cortez <[email protected]>
 
 	* ThemeWin32Classic.cs: When drawing ListViewItem instancesin Details

+ 3 - 4
mcs/class/Managed.Windows.Forms/System.Windows.Forms/ListView.cs

@@ -1075,8 +1075,10 @@ namespace System.Windows.Forms
 					return;
 
 				virtual_list_size = value;
-				if (virtual_mode)
+				if (virtual_mode) {
+					selected_indices.Reset ();
 					Redraw (true);
+				}
 			}
 		}
 #endif
@@ -5547,9 +5549,6 @@ namespace System.Windows.Forms
 			internal void Reset ()
 			{
 				// force re-population of list
-#if NET_2_0
-				if (!owner.VirtualMode)
-#endif
 				list = null;
 			}
 

+ 6 - 4
mcs/class/Managed.Windows.Forms/System.Windows.Forms/ListViewItem.cs

@@ -489,6 +489,7 @@ namespace System.Windows.Forms
 
 		// When ListView uses VirtualMode, selection state info
 		// lives in the ListView, not in the item
+		// Also, in VirtualMode we can't Reset() the selection
 		[Browsable (false)]
 		[DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)]
 		public bool Selected {
@@ -517,12 +518,13 @@ namespace System.Windows.Forms
 							owner.SelectedIndices.InsertIndex (Index);
 						else
 							owner.SelectedIndices.RemoveIndex (Index);
-					else
+					else 
 #endif
+					{
 						selected = value;
-						
-					// force re-population of list
-					owner.SelectedIndices.Reset ();
+						owner.SelectedIndices.Reset (); // force re-population of list
+					}
+
 #if NET_2_0
 					owner.OnItemSelectionChanged (new ListViewItemSelectionChangedEventArgs (this, Index, value));
 #endif