2008-10-17 Mario Carrion <mcarrion@novell.com>
authorMario Carrion <mario@carrion.mx>
Fri, 17 Oct 2008 16:09:31 +0000 (16:09 -0000)
committerMario Carrion <mario@carrion.mx>
Fri, 17 Oct 2008 16:09:31 +0000 (16:09 -0000)
* ComboBox.cs, ListBox.cs: Using added/removed item in
  OnUIACollectionChangedEvent instead of index.

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

mcs/class/Managed.Windows.Forms/System.Windows.Forms/ChangeLog
mcs/class/Managed.Windows.Forms/System.Windows.Forms/ComboBox.cs
mcs/class/Managed.Windows.Forms/System.Windows.Forms/ListBox.cs

index ebdb4c23b63578b2c025e4d4fdb8015f462eb8e9..6d45050a7c2d2d5b29162a645bf9e2921c105d11 100644 (file)
@@ -1,3 +1,8 @@
+2008-10-17  Mario Carrion <mcarrion@novell.com>
+
+       * ComboBox.cs, ListBox.cs: Using added/removed item in 
+         OnUIACollectionChangedEvent instead of index.
+
 2008-10-17  Jonathan Pobst  <monkey@jpobst.com>
 
        * ComboBox.cs: When we are sorting the items, if the item's type
index a8923e854a801744b098898fa4a940ea66c60f72..c505021fd3dc78d1263b3ccfdbd8919281ec9b24 100644 (file)
@@ -848,6 +848,10 @@ namespace System.Windows.Forms
                        get { return textbox_ctrl; }
                }
 
+               internal ListBox UIAListBox {
+                       get { return listbox_ctrl; }
+               }
+
                #endregion UIA Framework Properties
 
                #region Public Methods
@@ -2005,14 +2009,14 @@ namespace System.Windows.Forms
 
 #if NET_2_0
                                        //UIA Framework event: Item Removed
-                                       OnUIACollectionChangedEvent (new CollectionChangeEventArgs (CollectionChangeAction.Remove, index));
+                                       OnUIACollectionChangedEvent (new CollectionChangeEventArgs (CollectionChangeAction.Remove, object_items [index]));
 #endif
 
                                        object_items[index] = value;
                                        
 #if NET_2_0
                                        //UIA Framework event: Item Added
-                                       OnUIACollectionChangedEvent (new CollectionChangeEventArgs (CollectionChangeAction.Add, index));
+                                       OnUIACollectionChangedEvent (new CollectionChangeEventArgs (CollectionChangeAction.Add, value));
 #endif
 
                                        if (owner.listbox_ctrl != null)
@@ -2070,7 +2074,7 @@ namespace System.Windows.Forms
                                
 #if NET_2_0
                                //UIA Framework event: Items list cleared
-                               OnUIACollectionChangedEvent (new CollectionChangeEventArgs (CollectionChangeAction.Refresh, -1));
+                               OnUIACollectionChangedEvent (new CollectionChangeEventArgs (CollectionChangeAction.Refresh, null));
 #endif
                        }
                        
@@ -2137,7 +2141,7 @@ namespace System.Windows.Forms
                                        object_items.Insert (index, item);
 #if NET_2_0
                                        //UIA Framework event: Item added
-                                       OnUIACollectionChangedEvent (new CollectionChangeEventArgs (CollectionChangeAction.Add, index));
+                                       OnUIACollectionChangedEvent (new CollectionChangeEventArgs (CollectionChangeAction.Add, item));
 #endif                                 
                                }
                                
@@ -2163,12 +2167,17 @@ namespace System.Windows.Forms
                                if (index == owner.SelectedIndex)
                                        owner.SelectedIndex = -1;
 
+#if NET_2_0
+                               object removed = object_items [index];
+#endif
+
+
                                object_items.RemoveAt (index);
                                owner.UpdatedItems ();
                                
 #if NET_2_0
                                //UIA Framework event: Item removed
-                               OnUIACollectionChangedEvent (new CollectionChangeEventArgs (CollectionChangeAction.Remove, index));
+                               OnUIACollectionChangedEvent (new CollectionChangeEventArgs (CollectionChangeAction.Remove, removed));
 #endif
                        }
                        #endregion Public Methods
@@ -2193,7 +2202,7 @@ namespace System.Windows.Forms
                                                                
 #if NET_2_0
                                                        //UIA Framework event: Item added
-                                                       OnUIACollectionChangedEvent (new CollectionChangeEventArgs (CollectionChangeAction.Add, index));
+                                                       OnUIACollectionChangedEvent (new CollectionChangeEventArgs (CollectionChangeAction.Add, item));
 #endif
 
                                                        return index;
@@ -2205,7 +2214,7 @@ namespace System.Windows.Forms
                                
 #if NET_2_0
                                //UIA Framework event: Item added
-                               OnUIACollectionChangedEvent (new CollectionChangeEventArgs (CollectionChangeAction.Add, object_items.Count - 1));
+                               OnUIACollectionChangedEvent (new CollectionChangeEventArgs (CollectionChangeAction.Add, item));
 #endif
                                
                                return object_items.Count - 1;
index e7f38095ee72762bbf4f26a6a22c5980f6af0e64..a1e6381e2e8757bba2a7f319d5d7c8cd476fc4d9 100644 (file)
@@ -1,4 +1,4 @@
-// Permission is hereby granted, free of charge, to any person obtaining
+/// Permission is hereby granted, free of charge, to any person obtaining
 // a copy of this software and associated documentation files (the
 // "Software"), to deal in the Software without restriction, including
 // without limitation the rights to use, copy, modify, merge, publish,
@@ -2516,14 +2516,14 @@ namespace System.Windows.Forms
                                                
 #if NET_2_0
                                        //UIA Framework event: Item Removed
-                                       OnUIACollectionChangedEvent (new CollectionChangeEventArgs (CollectionChangeAction.Remove, index));
+                                       OnUIACollectionChangedEvent (new CollectionChangeEventArgs (CollectionChangeAction.Remove, object_items [index]));
 #endif
 
                                        object_items[index] = value;
                                        
 #if NET_2_0
                                        //UIA Framework event: Item Added
-                                       OnUIACollectionChangedEvent (new CollectionChangeEventArgs (CollectionChangeAction.Add, index));
+                                       OnUIACollectionChangedEvent (new CollectionChangeEventArgs (CollectionChangeAction.Add, value));
 #endif                                 
 
                                        owner.CollectionChanged ();
@@ -2594,7 +2594,7 @@ namespace System.Windows.Forms
 
 #if NET_2_0
                                //UIA Framework event: Items list cleared
-                               OnUIACollectionChangedEvent (new CollectionChangeEventArgs (CollectionChangeAction.Refresh, -1));
+                               OnUIACollectionChangedEvent (new CollectionChangeEventArgs (CollectionChangeAction.Refresh, null));
 #endif
                        }
 
@@ -2660,7 +2660,7 @@ namespace System.Windows.Forms
                                
 #if NET_2_0
                                //UIA Framework event: Item Added
-                               OnUIACollectionChangedEvent (new CollectionChangeEventArgs (CollectionChangeAction.Add, index));
+                               OnUIACollectionChangedEvent (new CollectionChangeEventArgs (CollectionChangeAction.Add, item));
 #endif
                        }
 
@@ -2679,13 +2679,19 @@ namespace System.Windows.Forms
                                if (index < 0 || index >= Count)
                                        throw new ArgumentOutOfRangeException ("Index of out range");
 
+
+#if NET_2_0
+                               //UIA Framework element removed
+                               object removed = object_items [index];
+#endif
+
                                owner.selected_indices.Remove (index);
                                object_items.RemoveAt (index);
                                owner.CollectionChanged ();
                                
 #if NET_2_0
                                //UIA Framework event: Item Removed
-                               OnUIACollectionChangedEvent (new CollectionChangeEventArgs (CollectionChangeAction.Remove, index));
+                               OnUIACollectionChangedEvent (new CollectionChangeEventArgs (CollectionChangeAction.Remove, removed));
 #endif
                        }
                        #endregion Public Methods
@@ -2701,7 +2707,7 @@ namespace System.Windows.Forms
 
 #if NET_2_0
                                //UIA Framework event: Item Added
-                               OnUIACollectionChangedEvent (new CollectionChangeEventArgs (CollectionChangeAction.Add, cnt));
+                               OnUIACollectionChangedEvent (new CollectionChangeEventArgs (CollectionChangeAction.Add, item));
 #endif
 
                                return cnt;