How to disable tabs on a bound collection

2 posts, 0 answers
  1. Asela
    Asela avatar
    6 posts
    Member since:
    Jan 2011

    Posted 07 Oct 2011 Link to this post

    Hi there,

    I have a dynamic collection which I bind to the tab control, however, I would also like to be able to enable / disable the tabs based on some criteria, however, I am unsure of what to  bind to so I Can disable tabbing to the control.

    I followed your basic demo for binding to a collection please see code below

            <telerik:RadTabControl ItemsSource="{Binding People}" >
                        <TextBlock Text="{Binding Name}"/>
                        <TextBlock Text="{Binding Age}"/>

  2. Petar Mladenov
    Petar Mladenov avatar
    2882 posts

    Posted 11 Oct 2011 Link to this post

    Hi Asela,

     Supposing you are following the approach demonstrated in this help article, you can introduce boolean property in the Person class:

    public class Person
         public Person(string name, int age)
             this.Name = name;
             this.Age = age;
         public string Name
         public int Age
         public bool Enabled { get; set; }
    and bind it to the IsEnabled property of the corresponding RadTabItems via StyleBindings:
               <local:ViewModel x:Key="DataSource" />
               <Style TargetType="telerik:RadTabItem">
                   <Setter Property="IsEnabled" Value="{Binding Enabled, Mode=TwoWay}" />
               <DataTemplate x:Key="ContentTemplate">
                       <TextBlock Text="{Binding Age}" />
    You can find this realized in the attached solution. Please let us know if this is what you need. Greetings,
    Petar Mladenov
    the Telerik team

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

  3. DevCraft R3 2016 release webinar banner
Back to Top