update tab header

3 posts, 1 answers
  1. Jingmeng
    Jingmeng avatar
    18 posts
    Member since:
    Jun 2010

    Posted 11 Aug 2010 Link to this post

    hi everyone,
    i have a problem on changing tab header, what i did is bind header textblock with a property of a C# object, but once i modify the property, the textblock(tab header) did change
    code is looks like :
        radTab.ItemContainerStyle = App.Current.Resources["TabItemStyle"] as Style;
        radTab.ItemsSource = TabCollection;
    TabCollection.add(new TabItem(){Header = "aa", IconPath = "~/Images/Icon1.png", Content = object})
    xaml looks like:
    <Style x:Key="TabItemStyle" TargetType="telerikNavigation:RadTabItem">
        <Setter Property="HeaderTemplate" >
                <DataTemplate x:Key="TabHeader">
                    <StackPanel Orientation="Horizontal"  >
                       <Image x:Name="HeaderIcon" Source="{Binding IconPath, Mode=TwoWay}" Margin="3, 0, 3, 0" Width="40" Height="20"/>
                       <TextBlock x:Name="HeaderText" Text="{Binding Header, Mode=TwoWay}" HorizontalAlignment="Center" VerticalAlignment="Center"/>
        <Setter Property="Height" Value="35" />
        <Setter Property="MaxWidth" Value="300" />
        <Setter Property="MinWidth" Value="120" />
        <Setter Property="ContentTemplate">
                    <controlsToolkit:DockPanel HorizontalAlignment="Stretch" VerticalAlignment="Stretch">
                        <ContentPresenter Content="{Binding Content}"/>

    once i go change tabItemCollection, tab header remain the same, any suggest how can i update?

    best regards
  2. Answer
    Miroslav avatar
    922 posts

    Posted 16 Aug 2010 Link to this post

    Hello Jingmeng,

    Yout xaml code looks correct.

    Can you confirm that the TabItem class implements INotifyPropertyChanged and that the PropertyChanged event is raised in the setter of the "Header" property?

    If this is not the case then the binding will not update.

    All the best,
    the Telerik team
    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 Public Issue Tracking system and vote to affect the priority of the items
  3. Jingmeng
    Jingmeng avatar
    18 posts
    Member since:
    Jun 2010

    Posted 18 Aug 2010 Link to this post

    hey Miroslav,
    thanx for your help, it's working good now!!

    best regards
Back to Top