This is a migrated thread and some comments may be shown as answers.

Why does the Loaded event fire for a UserControl on a tab when tab gets added to TabControl?

1 Answer 482 Views
TabControl
This is a migrated thread and some comments may be shown as answers.
ClausDC
Top achievements
Rank 1
Iron
ClausDC asked on 11 Apr 2013, 09:01 AM
I thought the Loaded event should only fire when the control is just about to render?

When I programmatically add a tab to the TabControl with a UserControl on it, the Loaded event of the UserControl fires although the tab isn't selected and thus the UserControl shouldn't be rendered.

I'm also asking because I then have the problem that when I set the SelectedItem of the TabControl to be the newly added Tab, the Loaded event of the UserControl gets fired yet again.

So in the process of adding and selecting the tab, the Loaded event of the UserControl gets fired twice which isn't desirable.

Edit: It does only seem to happen if the first tab is added to the TabControl for the first time.

Why is that, and is there a better way to prevent this from happening without resorting to some sort of boolean flag testing solution in the Loaded event handler?

1 Answer, 1 is accepted

Sort by
0
Pavel R. Pavlov
Telerik team
answered on 15 Apr 2013, 03:37 PM
Hi Claus,

We can confirm that this is a bug in the control and this is why it is already logged in our PITS. You can rise its priority by giving your vote for it here. Also, in our PITS, you can track the status of this issue. Please vote for this item as your vote will help us to understand the impact of this behavior.

Please accept our apologize for the inconvenience caused. Thank you for understanding.

Regards,
Pavel R. Pavlov
the Telerik team

Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

Tags
TabControl
Asked by
ClausDC
Top achievements
Rank 1
Iron
Answers by
Pavel R. Pavlov
Telerik team
Share this question
or