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

TabControl Header Style - Invalid attribute value

3 Answers 114 Views
TabControl
This is a migrated thread and some comments may be shown as answers.
anwar
Top achievements
Rank 1
anwar asked on 28 Sep 2009, 06:48 PM
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

3 Answers, 1 is accepted

Sort by
0
Bobi
Telerik team
answered on 30 Sep 2009, 01:26 PM
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.
0
anwar
Top achievements
Rank 1
answered on 01 Oct 2009, 12:05 PM
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>

 


0
Miroslav
Telerik team
answered on 05 Oct 2009, 12:13 PM
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.
Tags
TabControl
Asked by
anwar
Top achievements
Rank 1
Answers by
Bobi
Telerik team
anwar
Top achievements
Rank 1
Miroslav
Telerik team
Share this question
or