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

Sync between RadTreeView and RadCarousel

5 Answers 61 Views
Carousel
This is a migrated thread and some comments may be shown as answers.
Vien Nguyen
Top achievements
Rank 1
Vien Nguyen asked on 28 May 2011, 04:59 AM
I am using both a RadTreeView and a RadCarousel and bind the root nodes of the tree view and the carousel to the same list of items. If the user change the selection on one control, I would like the app to automaticall change the selected item on the other control. I tried to bind the SelectedItem property on both control to the same object but that did work. Has anyone tried this before?  Thanks.

5 Answers, 1 is accepted

Sort by
0
Accepted
Maya
Telerik team
answered on 30 May 2011, 12:43 PM
Hi Vien Nguyen,

You may bind the SelectedItem of both the RadCarousel and RadTreeView to a property in your ViewModel for example:

<telerik:RadTreeView x:Name="treeView" ItemsSource="{Binding Clubs}" SelectedItem="{Binding SelectedItem, Mode=TwoWay}" />
        <telerik:RadCarousel x:Name="carousel" ItemsSource="{Binding Clubs}" SelectedItem="{Binding SelectedItem, Mode=TwoWay}" Grid.Row="1" />

However, this will be applicable only if the item you want to select from the TreeView is visible in the RadCarousel. Otherwise, you may handle the SelectionChanged event of the TreeView and set the selected item of the Carousel:
private void treeView_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            foreach (var item in e.AddedItems)
            {
                this.carousel.BringDataItemIntoView(item);
                this.carousel.SelectedItem = item;
            }
        }

Do let me know whether the suggested approach fits into your requirements.
 

Regards,
Maya
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
0
Vien Nguyen
Top achievements
Rank 1
answered on 31 May 2011, 03:35 PM
Still doesnt work.
0
Maya
Telerik team
answered on 31 May 2011, 05:20 PM
Hi Vien Nguyen,

I am sending you the sample project I created for the case. Please take a look at it and let me know if it differs from your settings and requirements. If needed, feel free to change it in the way you want and send it back so that I can seed your particular scenario.
 

All the best,
Maya
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
0
Vien Nguyen
Top achievements
Rank 1
answered on 02 Jun 2011, 02:41 PM
Thanks for the example. It works when selection on the tree is changed. How do I make it so that scrolling through the carousel also scroll through the tree. Thanks.
0
Vien Nguyen
Top achievements
Rank 1
answered on 02 Jun 2011, 02:48 PM
I got it to work now. Thank you.
Tags
Carousel
Asked by
Vien Nguyen
Top achievements
Rank 1
Answers by
Maya
Telerik team
Vien Nguyen
Top achievements
Rank 1
Share this question
or