Tab selection event

2 posts, 0 answers
  1. Mikhail
    Mikhail avatar
    12 posts
    Member since:
    Jul 2017

    Posted 18 Jul Link to this post

    Hello,

    I was wondering if TabView has events, for example, on tab selection? If I wanted to load contents of a tab only when it is selected, is there such a mechanism available?

  2. Stefan Nenchev
    Admin
    Stefan Nenchev avatar
    501 posts

    Posted 21 Jul Link to this post

    Hi Mikhail,

    Currently, the TabView does not expose such events. I have logged your requirement as a feature request in our Ideas & Feedback portal - TabView: Introduce events related to the Tab selection. I suggest you follow the item in order to receive automatic notifications for major updates. I have also added some points to your account for the suggestion.

    In the meantime, you can subscribe to the PropertyChanged event of the RadTabView to get notified when the SelectedItem is changed. For example:

    private void TabView_PropertyChanged(object sender, System.ComponentModel.PropertyChangedEventArgs e)
           {
               if (e.PropertyName == "SelectedItem")
               {
                   var selectedTab = this.TabView.SelectedItem as TabViewItem;
                   if (selectedTab.HeaderText == "Folder")
                   {
                       selectedTab.Content = new Label() { Text = "This is the content of the Folder tab", BackgroundColor = Color.Red };
                   }
               }
           }

    Have a great weekend.

    Regards,
    Stefan Nenchev
    Progress Telerik
    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 Feedback Portal and vote to affect the priority of the items
Back to Top