TabItem redrawing.

2 posts, 0 answers
  1. Stas
    Stas avatar
    11 posts
    Member since:
    Aug 2010

    Posted 25 Aug 2010 Link to this post

    Hi, I've got the problem with TabControl: I subscribe to PreviewSelectionChanged event and then after some check set e.Handle = true to prevent tab switching. The check itself is performed not quickly and there's the bug: if user move mouse out from the tab item he want to switch to while PreviewSelectionChanged is being performed, then both tabitems (old and new) are displayed as selected.
    What should I do to avoid this behaviour? how to force tab item rendering?

    Info: Assembly: Telerik.Windows.Controls.Navigation, Version=2010.2.812.1040
  2. Hristo
    Hristo avatar
    352 posts

    Posted 30 Aug 2010 Link to this post

    Hello Stas,

    This is a feature of the RadTabControl. Both items look selected (in fact one is selected and the other one is in state MouseOver) because the UI thread is busy with the calculations and therefore no redrawing is performed until they are over. The solution in that case is to handle the event (e.Handeled = true) and start the time consuming operations in different thread. After calculations are finished you need to change the selected tab to the initially selected one. You can add an indication that some work is going on by using the BusyIndicator.

    I'm attaching a sample project demonstrating how to implement the suggested solution. You can extend and improve it to fit your needs. Notice that I'm storing only one tab header, so if you quickly click several tabs while the calculation is taking place the item headers will be updated with wrong values.

    All the best,
    Hristo Milyakov
    the Telerik team
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
Back to Top