TabControl Header Style - Invalid attribute value

4 posts, 0 answers
  1. anwar
    anwar avatar
    23 posts
    Member since:
    Jun 2009

    Posted 28 Sep 2009 Link to this post

    Hello,

    I am using PRISM, Telerik Docking and Tabcontrols. I have 2 modules and loaded the two modules in MainContentRegion(

    telerikDocking

     

    :RadDocking.DocumentHost) as two tabs.

      But the tabs doesnot showing its header value.

    I define the Header Style in my Usercontrol Resources and i am getting the below error.

    Invalid attribute value {x:Type telerikNavigation:RadTabItem} for property TargetType. [Line: 11 Position: 27]

    I am using PRISM, and the MainContentRegion contains one or more tabs.

    Here is the code snippet.

     

    <

     

    UserControl

     

     

     

    x:Class="PBI.Client.Shell"

     

     

     

    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"

     

     

     

    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"

     

     

     

    xmlns:Regions="clr-namespace:Microsoft.Practices.Composite.Presentation.Regions;assembly=Microsoft.Practices.Composite.Presentation"

     

     

     

    xmlns:telerikNavigation="clr-namespace:Telerik.Windows.Controls;assembly=Telerik.Windows.Controls.Navigation"

     

     

     

    xmlns:telerikDocking="clr-namespace:Telerik.Windows.Controls;assembly=Telerik.Windows.Controls.Docking"

     

     

     

    Height="Auto" Width="Auto">

     

     


    <

     

    UserControl.Resources>

     

     

     

     

    <Style TargetType="{x:Type telerikNavigation:RadTabItem}" x:Key="HeaderStyle">

     

     

     

     

    <Setter Property="Header"

     

     

     

    Value="{Binding RelativeSource={RelativeSource Self}, Path=Content.DataContext.TabHeader}" />

     

     

     

     

    </Style>

     

     

     

     

    </UserControl.Resources>

     

     


    <!-- Main Content Region -->

     

     

    <telerikDocking:RadDocking.DocumentHost>

     

     

     

     

    <telerikNavigation:RadTabControl Name="tabMainContentRegion" TabStripPlacement="Bottom"

     

     

     

    Regions:RegionManager.RegionName="MainContentRegion"

     

     

     

    ItemContainerStyle="{StaticResource HeaderStyle}" >  

     

     

     

     

    </telerikNavigation:RadTabControl>

     

     

     

     

    </telerikDocking:RadDocking.DocumentHost>

     

     


    TabHeader is defined in my Viewmodel class.

    The same code works in WPF but not in  Silverlight.

    Help will be appriciated.

    Anwar

  2. Bobi
    Admin
    Bobi avatar
    513 posts

    Posted 30 Sep 2009 Link to this post

    Hello anwar,

    In Silverlight instead of using {x:Type telerikNavigation:RadTabItem} you have to use:

    <Style TargetType="telerikNavigation:RadTabItem" x:Key="HeaderStyle">

    I hope that this will help you.
     Please let us know if  you have any other questions.

    Sincerely yours,
    Boryana
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
  3. DevCraft banner
  4. anwar
    anwar avatar
    23 posts
    Member since:
    Jun 2009

    Posted 01 Oct 2009 Link to this post

    Hello Boryana,

    Thanks for your reply, your suggesion helps to fix the error.

    Still i am not getting the header value in my tab. Here is my resource and tabcontrol definition.

     

     

    <UserControl.Resources>

     

     

     

    <Style TargetType="telerikNavigation:RadTabItem" x:Key="HeaderStyle">

     

     

     

    <Setter Property="Header">

     

     

     

    <Setter.Value>

     

     

     

    <DataTemplate>

     

     

     

    <TextBlock Text="{Binding RelativeSource={RelativeSource Self}, Path=DataContext.TabHeader}" FontSize="12" VerticalAlignment="Center" />

     

     

     

    </DataTemplate>

     

     

     

    </Setter.Value>

     

     

     

    </Setter>

     

     

     

    </Style>

     

     

     

    </UserControl.Resources>

     


    <

     

    telerikDocking:RadDocking.DocumentHost>

     

     

     

    <telerikNavigation:RadTabControl Name="tabMainContentRegion" TabStripPlacement="Bottom"

     

     

    Regions:RegionManager.RegionName="MainContentRegion"

     

     

    ItemContainerStyle="{StaticResource HeaderStyle}" >

     

    </

     

    telerikNavigation:RadTabControl>

     

     

     

    </telerikDocking:RadDocking.DocumentHost>

     


  5. Miroslav
    Admin
    Miroslav avatar
    922 posts

    Posted 05 Oct 2009 Link to this post

    Hi anwar,

    The Header ot of the TabItem will be set to the object that it is bound to. You can use the HeaderTemplate to specify how the header will look, given that it will be set to the data object.

    If you have a TabHeader proeprty on the objects that you bind to, you will have to change your xaml like so:

    <Style TargetType="telerikNavigation:RadTabItem" x:Key="HeaderStyle">  
        <Setter Property="HeaderTemplate">  
            <Setter.Value> 
                <DataTemplate> 
                    <TextBlock  
                            Text="{Binding TabHeader}" 
                            FontSize="12" VerticalAlignment="Center" /> 
                </DataTemplate> 
            </Setter.Value> 
        </Setter> 
    </Style> 

    Hopefully this will solve your issue.

    All the best,
    Miroslav
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
Back to Top