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

2 posts, 0 answers
  1. ClausDC
    ClausDC avatar
    65 posts
    Member since:
    Feb 2010

    Posted 11 Apr 2013 Link to this post

    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?
  2. Pavel R. Pavlov
    Pavel R. Pavlov avatar
    1251 posts

    Posted 15 Apr 2013 Link to this post

    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.

    Pavel R. Pavlov
    the Telerik team

    Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

Back to Top