Skip to main content
Home Forums Silverlight Programming Report a Silverlight Bug [Silverlight 3 Beta + Toolkit] Explicit styles inside a theme are ignored
2 replies. Latest Post by Allen Chen – MSFT on April 2, 2009.
(0)
simon.fe...
Member
202 points
61 Posts
03-31-2009 5:30 AM |
See the following piece of xaml :
<UserControl x:Class="BugReproTheming.MainPage" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:dark="clr-namespace:System.Windows.Controls.Theming;assembly=System.Windows.Controls.Theming.ExpressionDark"> <UserControl.Resources> <Style TargetType="TextBox" x:Key="explicit"> <Setter Property="Background" Value="Red" /> </Style> </UserControl.Resources> <dark:ExpressionDarkTheme> <Grid x:Name="LayoutRoot" > <Grid.ColumnDefinitions> <ColumnDefinition Width="Auto" /> <ColumnDefinition Width="*" /> </Grid.ColumnDefinitions> <StackPanel> <HyperlinkButton Content="Home" Tag="/Home.xaml" Click="Goto" /> <HyperlinkButton Content="Page 1" Tag="/Page1.xaml" Click="Goto" /> <HyperlinkButton Content="Page 2" Tag="/Page2.xaml" Click="Goto" /> <TextBox Text="This textbox has an explicit style that is not correctly applied" Style="{StaticResource explicit}" /> </StackPanel> </Grid> </dark:ExpressionDarkTheme> </UserControl>
The explicit style is not applied on the TextBox, it is replaced by the default theme-style. That is a shame, as current shipped themes have no VisualStates for validation.
I don't know if this is the correct behavior, and if it does the same with Silverlight 2, but it seems very weird to me.
mehtapratik
269 points
302 Posts
03-31-2009 5:44 AM |
I had the same issue in silverlight 2 + toolkit
Allen Ch...
Star
13858 points
1,801 Posts
04-02-2009 3:46 AM |
Hi,
Thanks for reporting this issue. But codeplex is a more appropriate place to report Toolkit bug:
http://silverlight.codeplex.com/WorkItem/List.aspx
From your description I think it might be caused by the limitation that style could only be set once in current version. You can get the conclusive answer from codeplex.