Skip to main content

Microsoft Silverlight

Answered Question TabControl Style Exception: Invalid attribute value....RSS Feed

(0)

mr.saif
mr.saif

Member

Member

417 points

147 Posts

TabControl Style Exception: Invalid attribute value....

I have added style for TabControl, downloaded from msdn(http://msdn.microsoft.com/en-us/library/cc645035(VS.95).aspx), in app.xaml. whenever i run my application it throws following exception.

"Invalid attribute value local:TabControl for property TargetType. [Line: 643 Position: 26] ".

Regards,
Muhammad Saifullah

mr.saif
mr.saif

Member

Member

417 points

147 Posts

Re: TabControl Style Exception: Invalid attribute value....

futhermore I am using SL2 RTW release.. I have implemented styles to some other controls DataGrid, listBox, button, etc. they worked fine. But using tabControl style throws above metion exception, I think may be i am missing some reference or something?...I am stuck with this problem for last 2 days Sad.

Regards,
Muhammad Saifullah

Amanda Wang - MSFT
Amanda W...

All-Star

All-Star

17241 points

1,466 Posts

Answered Question

Re: TabControl Style Exception: Invalid attribute value....

Hi,

You need to add the System.Windows.Controls assembly for the app.xaml and usercontrol xaml file, for example:

1. Add the  assembly for the app.xaml file.

<Application xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             x:Class="scroll.App"
             xmlns:local="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls"
             xmlns:vsm="clr-namespace:System.Windows;assembly=System.Windows"
             xmlns:primitives="clr-namespace:System.Windows.Controls.Primitives;assembly=System.Windows.Controls"
             >
    <Application.Resources>

 2. Add the  assembly for the usercontrol's  xaml file.

<UserControl xmlns:local="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls" 
             xmlns:my2="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.Data"  x:Class="scroll.Page"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    Width="400" Height="300">
    <Grid x:Name="LayoutRoot" Background="White">
        <local:TabControl x:Name="tabcontrol" Style="{StaticResource newTabControlStyle}" >
            <local:TabItem  x:Name="tabitemFee" Header="first" Style="{StaticResource newTabItemStyle}" ></local:TabItem>
            <local:TabItem  x:Name="secon" Header="first" Style="{StaticResource newTabItemStyle}" ></local:TabItem>
            <local:TabItem  x:Name="third" Header="first" Style="{StaticResource newTabItemStyle}" ></local:TabItem>
            <local:TabItem  x:Name="forth" Header="first" Style="{StaticResource newTabItemStyle}" ></local:TabItem>
        </local:TabControl>
    </Grid>
</UserControl>

Amanda Wang
Microsoft Online Community Support

Please remember to mark the replies as answers if they help and unmark them if they provide no help.

micke_b
micke_b

Member

Member

2 points

3 Posts

Re: TabControl Style Exception: Invalid attribute value....

I have the excat same problem, and I done excatly above, problem remains ...

 What more can it be ?

tobidobi
tobidobi

Member

Member

2 points

1 Posts

Re: Re: TabControl Style Exception: Invalid attribute value....

Yes, me having the exact same problem: "Invalid attribute value controls:TabControl for property TargetType".

What am I doing wrong??

kiener
kiener

Member

Member

137 points

42 Posts

Re: Re: Re: TabControl Style Exception: Invalid attribute value....

I'm having the same problem too.

nkmoore
nkmoore

Member

Member

12 points

4 Posts

Re: Re: Re: TabControl Style Exception: Invalid attribute value....

 I'm also having the same issue, as far as I can tell it seems to be a bug in VS2008 with Silverlight.  It looks like the preview breaks if you have a style in app.xaml that has a TargetType of a control that lives in a different namespace to the default one.  Is there a fix or a work around for this as it's seriously annoying to not have a preview ?

  • Unanswered Question
  • Answered Question
  • Announcement
Microsoft Communities