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

RadTabControl in GridView details changes selected tab when scrolling grid

3 Answers 174 Views
TabControl
This is a migrated thread and some comments may be shown as answers.
StephenP
Top achievements
Rank 1
StephenP asked on 24 Mar 2011, 11:22 PM
Hi,

In your WPF GridView demo, First Look, if you expand a few rows, then choose a tab other than the first, when you scroll the GridView so that the row goes out of view and then you scroll it to reappear, the tab changes to the first one and there is a noticeable delay and jump of the scroll thumb.

I was creating a very similar arrangement and I'd like to know if there's a way to stop this behavior so that the selected tab remains constant while scrolling.

Thanks,

SP

3 Answers, 1 is accepted

Sort by
0
Petar Mladenov
Telerik team
answered on 30 Mar 2011, 12:28 PM
Hi StephenP,

The behavior you have come up with is expected. By default the RadGridView is virtualized and when you scroll up and down, its rows are being reloaded. RadTabControl as a child of the rows is being reloaded too. In order to prevent the loss of selection in the RadTabControl, you can turn the virtualization off or you can bind the SelectedItem (or SelectedIndex) property of the RadTabControl to a property of your ViewModel(as well as binding the IsSelected of the RadTabItem) Feel free to ask if you need further assistance. 

Greetings,
Petar Mladenov
the Telerik team
0
StephenP
Top achievements
Rank 1
answered on 30 Mar 2011, 09:50 PM
Hi Petar,

Thanks for the explanation. Turning virtualization off stops the scrolling issue and the tab switching behavior, but then the data loads very slowly (there's a lot) and makes the tab changes and child grid row expansions (we're creating a 3 level hierarchy - Main grid expands to tabbed child grids, which grid rows expand to another tab with grids) very slow to respond. BTW, the child grids and tabs are defined only in XAML, and I'm assigning the grids ItemsSource programmatically, from Observable collections matching the hierarchy of the grid.

I'm pretty new to WPF (although a long time developer), so it seems I need to do what you said regarding the binding of the tab control. I'm not currently using a ViewModel, just creating a test app to make sure the grid will function as desired and have the performance we want. It seems I would need to detect when a row is expanded and goes from being not visible to visible, but your idea sounds simpler.

But, I'm a little hazy on what property I would bind the SelectedItem, SelectedIndex and IsSelected to. Can you provide some more info? Let me know if you need more info from me.

Thank you,

StephenP
0
Petar Mladenov
Telerik team
answered on 05 Apr 2011, 12:51 PM
Hello StephenP,

You need a TabControlViewModel or Business Object that exposes an int property in order to bind it to the selected index of the TabControl or you can have TabItemViewmodel that exposes boolean property and bind it to the RadTabitem`s IsSelected property via style. You can find similar approach showing binding the RadTreeViewItem`s IsSelelcted property here.

All the best,
Petar Mladenov
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
StephenP
Top achievements
Rank 1
Answers by
Petar Mladenov
Telerik team
StephenP
Top achievements
Rank 1
Share this question
or