RadTabControl in GridView details changes selected tab when scrolling grid

4 posts, 0 answers
  1. StephenP
    StephenP avatar
    2 posts
    Member since:
    Mar 2011

    Posted 24 Mar 2011 Link to this post

    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
  2. Petar Mladenov
    Admin
    Petar Mladenov avatar
    2891 posts

    Posted 30 Mar 2011 Link to this post

    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
  3. UI for WPF is Visual Studio 2017 Ready
  4. StephenP
    StephenP avatar
    2 posts
    Member since:
    Mar 2011

    Posted 30 Mar 2011 Link to this post

    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
  5. Petar Mladenov
    Admin
    Petar Mladenov avatar
    2891 posts

    Posted 05 Apr 2011 Link to this post

    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
Back to Top