top_index to 0.
svn path=/trunk/mcs/; revision=64764
2006-09-02 Alexander Olk <alex.olk@googlemail.com>
2006-09-02 Alexander Olk <alex.olk@googlemail.com>
- * ListBox.cs: Don't unselect an item if the selection ArrayList
- is empty. This prevents a crash when the collection was cleared
- before calling SelectedIndex.
+ * ListBox.cs: If the items are cleared with Items.Clear set
+ top_index to 0.
2006-09-01 Carlos Alberto Cortez <calberto.cortez@gmail.com>
2006-09-01 Carlos Alberto Cortez <calberto.cortez@gmail.com>
// Removes an item in the Selection array and marks it visually as unselected
private void UnSelectItem (int index, bool remove)
{
// Removes an item in the Selection array and marks it visually as unselected
private void UnSelectItem (int index, bool remove)
{
- if (selection.Count == 0)
- return;
-
internal virtual void CollectionChanged ()
{
if (sorted)
internal virtual void CollectionChanged ()
{
if (sorted)
- Sort ();
-
- if (!IsHandleCreated || suspend_layout)
- return;
-
- Layout ();
-
if (Items.Count == 0) {
selected_index = -1;
focused_item = -1;
if (Items.Count == 0) {
selected_index = -1;
focused_item = -1;
+
+ if (!IsHandleCreated || suspend_layout)
+ return;
+
+ Layout ();