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

TabItem redrawing.

1 Answer 40 Views
TabControl
This is a migrated thread and some comments may be shown as answers.
Stas
Top achievements
Rank 1
Stas asked on 25 Aug 2010, 01:37 PM
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

1 Answer, 1 is accepted

Sort by
0
Hristo
Telerik team
answered on 30 Aug 2010, 06:36 PM
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
Tags
TabControl
Asked by
Stas
Top achievements
Rank 1
Answers by
Hristo
Telerik team
Share this question
or