Selected Item

2 posts, 0 answers
  1. Kevin Marois
    Kevin Marois avatar
    16 posts
    Member since:
    May 2010

    Posted 20 Oct 2011 Link to this post

    In the C# Code behind, how do you set the selected item to an item already in the control. My XAML is

    <telerik:RadOutlookBar x:Name="RadOutlookBar"
                         SelectedItem="{Binding SelectedSection, Mode=TwoWay}">

    So in the view model, I want to iterate through all the Items, find one, then set the control's selected item to it. How do you iterate over the items collection?
  2. Tina Stancheva
    Tina Stancheva avatar
    3299 posts

    Posted 24 Oct 2011 Link to this post

    Hi Kevin Marois,

    I am not sure when you want to iterate through the items collection, but basically you don't have to use any of the RadOutlookBar properties as long as its ItemsSource is bound to a business collection and its SelectedItem is bound in a TwoWay mode to one of the items of this collection.

    In this case you can only work with the business data - iterate through the business collection of items that is used as the ItemsSource of the RadOutlookBar. And set the SelectedSection data item to one of the items from that business collection.

    I attached a sample project that illustrates my points. Please have a look at the solution and let me know if it works for you or if I'm missing something from your scenario.

    Tina Stancheva
    the Telerik team

    Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

Back to Top