Skip to main content
Home Forums Silverlight Programming Report a Silverlight Bug TabControl Style Exception: Invalid attribute value....
6 replies. Latest Post by nkmoore on June 25, 2009.
(0)
mr.saif
Member
417 points
147 Posts
10-22-2008 5:49 AM |
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] ".
10-22-2008 6:27 AM |
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 .
Amanda W...
All-Star
17241 points
1,466 Posts
10-24-2008 4:14 AM |
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>
micke_b
2 points
3 Posts
04-26-2009 11:29 AM |
I have the excat same problem, and I done excatly above, problem remains ...
What more can it be ?
tobidobi
1 Posts
05-12-2009 12:17 PM |
Yes, me having the exact same problem: "Invalid attribute value controls:TabControl for property TargetType".
What am I doing wrong??
kiener
137 points
42 Posts
05-26-2009 4:26 AM |
I'm having the same problem too.
nkmoore
12 points
4 Posts
06-25-2009 3:45 AM |
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 ?