First tab selected when binding async

2 posts, 0 answers
  1. Gabriel
    Gabriel avatar
    18 posts
    Member since:
    Jun 2011

    Posted 31 Oct 2011 Link to this post

    I have a situation where I bind my tabs through a MVVM patterns. The binding source is loaded async AFTER the TabControl is loaded. The tabs are loading correctly but I want the first tab to be selected when I got at least one tab in the TabControl or when I finish loaded.

    My current workaround is to have SelectedIndex (int) in my binded View-Model set to 1 and bind it to the SelectedIndex in the TabControl. Is there any other way of doing it more clean? Perhaps adding a property that force at least one tab to selected?

    Thanks
  2. Petar Mladenov
    Admin
    Petar Mladenov avatar
    2891 posts

    Posted 03 Nov 2011 Link to this post

    Hi Gabriel,

     I don't think binding the SelectedIndex property is not clean. However, you can introduce Selected boolean property in the ViewModels that the RadTabItems will bind to. Then just bind the RadTabItem.IsSelected to the Selected property via ContainerBindings. Please let us know if you need assistance on this. 

    Regards,
    Petar Mladenov
    the Telerik team

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

  3. DevCraft banner
Back to Top