Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
80
ISSUE: UltraListView item removal causes itemactivate event to fire
posted

To,
Infragistics Support,

 

I have following simple code.

private void Form1_Load(object sender, EventArgs e)

{

AddItems(10,
"abc", "pqr");

AddItems(20, "xyz", "wxy");

AddItems(30, "mns", "jpg");

}

class Order

{

public int Id = 10;

}

private void AddItems(int id, string s1, string s2)

{

Order o1 = new Order();

o1.Id = id;

UltraListViewItem item = new UltraListViewItem(s1, new string[

{

s2

});

item.Tag = o1;

ultraListView1.Items.Add(item);

}

private void button1_Click(object sender, EventArgs e)

{

UltraListViewItem ulv = ultraListView1.SelectedItems[0];

ultraListView1.SelectedItems.Remove(ulv);

ultraListView1.Items.Remove(ulv);

}

private void ultraListView1_ItemActivated(object sender, ItemActivatedEventArgs e)

{

 

UltraListViewItem item = e.Item;object o = item.Tag;

}

 

Issue:

when the line ultraListView1.Items.Remove(ulv); is being executed, usually it shouldn't fire any event.

but in this case

ultraListView1_ItemActivated(object sender, ItemActivatedEventArgs e)

being called from UltraListView internal routine/event mechanism.

 

we can always argue that

if ( item == null) should be there in ultraListView1_ItemActivated(...) this method. but

my question is why it is calling this event when the item is being removed ?

 

Please clarify.

Thanks

Paresh

 

 

  • 69832
    Offline posted

    The event probably should have been named 'ActiveItemChanged'; it is being called because the value of the ActiveItem property has changed. Note that this is a peer-to-peer forum, and not intended for logging bug reports. You should report this issue via the web support form so that you are notified when a fix becomes available.