NewDTinStackoverflow
NewDTinStackoverflow

Reputation: 543

Why could not I call this brush here?

I created a linearGradientBrush inside "Application.Resources" and tried to call it with one of the style setters. The compiler says the name could not be resolved. Could not see why....

     <Style x:Key="GridTextBoxStyle" TargetType="TextBox">
        <Setter Property="Background" Value="{StaticResource TextBlinearBrush}"/>
    </Style>
   <LinearGradientBrush x:Key="TextBlinearBrush" EndPoint="1,0.5" StartPoint="0,0.5">
                <GradientStop Color="Black" Offset="0" />
                <GradientStop Color="Gray" Offset="1" />
                <GradientStop Color="DarkGray" Offset="0.541" />
  </LinearGradientBrush>

Upvotes: 0

Views: 39

Answers (1)

evanb
evanb

Reputation: 3111

You'll need to define the brush before it is used. Just move the LinearGradientBrush above the Style where it is referenced and that should do the trick.

Upvotes: 3

Related Questions