Style Trigger not working...

muik

Member
Joined
Dec 3, 2009
Messages
13
Programming Experience
3-5
Hi everyone!

Here's a quick one - i'm not sure if I'm doing it right. I have an expander control with an imagebrush as the background. I want to change the imagebrush opacity if the control is expanded:

VB.NET:
<Style x:Key="ExpanderDefault" TargetType="{x:Type Expander}">
       <Style.Triggers>
            <Trigger Property="IsExpanded" Value="True">
                <Setter Property="Background">
                    <Setter.Value>
                        <ImageBrush Opacity="0.1" />
                    </Setter.Value>
                </Setter>
            </Trigger>
       </Style.Triggers>
</Style>

The code above is not working (expanding has no effect on the image's opacity). Here's how the expander is declared in my window:

VB.NET:
<Expander Name="Exp" Style="{StaticResource ExpanderDefault}" Height="130" Width="100">
    <Expander.Background>
        <ImageBrush ImageSource="http://n8ux.files.wordpress.com/2008/04/woot-copy.jpg" />
    </Expander.Background>
</Expander>

Am I missing something?

Thanks!
 
Back
Top