tags:

views:

90

answers:

2

I have a tab contol with two tabs. Each one containing listviews. When the selection change event of listview is fired, the selection change of tabcontrol is also fired. How can I prevent this?

+1  A: 

Set the Handled property of the EventArgs object to true when you are done with the listview event so it wont route further up the tree...

e.Handled = true;

HTH

Arcturus
You are right and it solves my problem. Thanks
Sauron
My first assumption was that the events were independent, when they're clearly not.
ChrisF
Nope, it is the same event.. It doesn't check the original source.. So its always a good idea to set your event on handled when you are done with it, to avoid suprises ;)..
Arcturus
A: 

Is your listview perhaps selecting a default item when the tab is selected?

James