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

Minor bug

2 Answers 77 Views
TabControl
This is a migrated thread and some comments may be shown as answers.
Ben Hayat
Top achievements
Rank 2
Ben Hayat asked on 09 Aug 2008, 10:17 PM
In order to work with each tab item (page) content, I need to turn the "IsSelected" off from the other item tabs and turn On the tab item I need to work on.

When I do that in Blend, I can see the IsSelected On or Off and the particular page is activated, however at runtime the first page always gets activated. By looking at the XAML code, I notice more than one tab Item the "IsSelected" is set to "True", therefore at runtime, it gets confused and the first one comes on. I'm not sure this is Blend problem or control problem and I thought I report it.

Thanks!
..Ben

2 Answers, 1 is accepted

Sort by
0
Accepted
Miroslav
Telerik team
answered on 12 Aug 2008, 07:28 AM
Hi Ben,

Blend does surprise me from time to time.

All the controls that are visible on the Blend surface are actually "live", i.e. all their internal logic is preserved, you can even debug them while they are running there.

When you set the IsSelected = true of a TabItem, the TabControl makes sure that no other item is selected (sets the other properties to false). It seems that when the property is changed by the TabControl Blend does not notice and the Xaml of the TabItem is not changed accordingly - the control is in a state that is not matched by the xaml. When I test it the control runs according to the xaml, i.e. the last item to have IsSelected = true is selected, if no such item exists, the Selected index is used (default value = 0, if at least one item exists)

I will investigate the disparity though I am not sure that we have control over how Blend generates the Xaml.

This behavior might be a little frustrating if you have to switch the content often. One workaround would be to use the SelectedIndex property of the TabControl instead of switching the IsSelected properties.

Thanks for the feedback! I will check whether Blend behaves similarly in other cases as well. And of course, if this turns out to be a bug in the control, you'll get your points.

All the best,
Miroslav
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
0
Ben Hayat
Top achievements
Rank 2
answered on 13 Aug 2008, 12:34 AM
Hi Miroslav;

Blend does surprise me from time to time.
You are very kind to put it in that phrase ;-)
I usually say "Blend frustrates the hell out of me, ALL THE TIME" ;-)

This behavior might be a little frustrating if you have to switch the content often. One workaround would be to use the SelectedIndex property of the TabControl instead of switching the IsSelected properties.
Excellent solution. Works much better with SelectedIndex. Thank you!
Tags
TabControl
Asked by
Ben Hayat
Top achievements
Rank 2
Answers by
Miroslav
Telerik team
Ben Hayat
Top achievements
Rank 2
Share this question
or