Skip to main content

Microsoft Silverlight

Answered Question [Silverlight 3 Beta + Toolkit] Explicit styles inside a theme are ignoredRSS Feed

(0)

simon.ferquel
simon.fe...

Member

Member

202 points

61 Posts

[Silverlight 3 Beta + Toolkit] Explicit styles inside a theme are ignored

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.

Simon Ferquel
MVP Client App Dev
http://www.simonferquel.net/blog

mehtapratik
mehtapratik

Member

Member

269 points

302 Posts

Re: [Silverlight 3 Beta + Toolkit] Explicit styles inside a theme are ignored

 I had the same issue in silverlight 2 + toolkit

Pratik Mehta
Espirit Softwares Pvt. Ltd.
India.

Allen Chen – MSFT
Allen Ch...

Star

Star

13858 points

1,801 Posts

Answered Question

Re: [Silverlight 3 Beta + Toolkit] Explicit styles inside a theme are ignored

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.

Sincerely,
Allen Chen
Microsoft Online Community Support

Please remember to mark the replies as answers if they help and unmark them if they provide no help.
  • Unanswered Question
  • Answered Question
  • Announcement
Microsoft Communities