views:

851

answers:

2

currently i am forcing my WPF app to use the luna theme no matter what, with this XAML code

<Application.Resources>
    <ResourceDictionary>
        <ResourceDictionary.MergedDictionaries>
            <ResourceDictionary Source="Styles.xaml" />
            <ResourceDictionary Source="NavigationCommands.xaml" />
            <ResourceDictionary Source="/RibbonControlsLibrary;component/Themes/Office2007Blue.xaml"/>
            <ResourceDictionary Source="/PresentationFramework.Luna, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, ProcessorArchitecture=MSIL;;component/Themes/luna.normalcolor.xaml" /> 
            </ResourceDictionary.MergedDictionaries>
    </ResourceDictionary>
</Application.Resources>

and now i want to extend the style of every textbox with this validation trigger

<Style TargetType="TextBox">
    <Style.Triggers>
        <Trigger Property="Validation.HasError" Value="true">
            <Setter Property="Background" Value="#d3e1f3"></Setter>
            <Setter Property="ToolTip"
            Value="{Binding RelativeSource={RelativeSource Self}, 
                   Path=(Validation.Errors)[0].ErrorContent}"/>
        </Trigger>
    </Style.Triggers>
</Style>

but this trigger does not work, because i forced the luna theme. (without the forced theme every thing works as it should, but doesn't look as it should :( ) is there some way to force the luna theme and extend it's style? probably over the BasedOn property?

atm i defined a key for the style in question and added it to every textbox by hand, that works but isn't the prettiest way to go.

tia

+1  A: 

Try

<Style x:Key="{x:Type TextBox}" TargetType="{x:Type TextBox}">
Jobi Joy
that does not work either, but thank you anyway
marc.d
+1  A: 

The BasedOn syntax for type styles is as follows:

<Style TargetType="TextBox" BasedOn="{StaticResource {x:Type TextBox}}">

HTH

Arcturus
no luck :(the approach over the basedon property does not work. the style gets ignored.thank you.
marc.d