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

Tab selection event

3 Answers 588 Views
TabView
This is a migrated thread and some comments may be shown as answers.
Mikhail
Top achievements
Rank 1
Mikhail asked on 18 Jul 2017, 08:34 PM

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?

3 Answers, 1 is accepted

Sort by
0
Stefan Nenchev
Telerik team
answered on 21 Jul 2017, 07:53 AM
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
0
Chris
Top achievements
Rank 2
Veteran
answered on 10 Feb 2021, 06:50 PM
For some reason the PropertyChanged event is not firing for me. Any ideas?
0
Yana
Telerik team
answered on 11 Feb 2021, 10:43 AM
Hi Chris,

I've just teste the provided snippet and it's working without a problem on my side.  I am not sure what could cause the issue you've come across, it would be of great help if you can isolate it in a simpler solution and send it over, so I can take a look.

Keep in mind that you would need to create a support ticket in our ticketing system and attach the solution as a zip file there.

Regards,
Yana
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
Tags
TabView
Asked by
Mikhail
Top achievements
Rank 1
Answers by
Stefan Nenchev
Telerik team
Chris
Top achievements
Rank 2
Veteran
Yana
Telerik team
Share this question
or