locked
Button style does not display within designer RRS feed

  • Question

  • Using Expression Blend 3.   I'm pretty new to using Expression Blend (EB), prior to now, I've always used Visual Studio when editing any xaml files.  Anyway, I've been working on a simple test page and ran into a strange problem.  I put a button on the form and wanted to give it a LinearGradientBrush background.  The problem is, the button doesn't change, no errors or anything, the buttons appearance just doesn't change.   At first, I tried specifying the background by applying it to the button directly.  When that didn't work, I tried creating a style, still no luck.  I know the xaml markup is ok because I copied the xaml out of EB and put into a test page, within Visual Studio, and it works as expected.  Below is part of the xaml that's causing problems.

     

     <UserControl.Resources>
      <Style x:Key="GradientButtonStyle" TargetType="Button">
       <Setter Property="Background">
        <Setter.Value>
         <LinearGradientBrush StartPoint="0.5,0" EndPoint="0.5,1">
          <GradientStop Color="LightGray" Offset="0.1"/>
          <GradientStop Color="DarkBlue" Offset="0.9"/>
         </LinearGradientBrush>
        </Setter.Value>
       </Setter>
      </Style>
     </UserControl.Resources>

      <Button Grid.Row="1" Grid.Column="0" Height="75" Width="150" Style="{StaticResource GradientButtonStyle}"/>

     

    Unrelated to the above issue, I have a couple questions/comments.

    1) No mouse right click menu in the Blend designer?  Specifically, no cut/paste, you have to use ctrl/c or the main menu.  Why is this?

    2)  In the xaml editor, no ability to collapse/expand elements.Why is this?

     

    TIA

    Thursday, April 18, 2013 9:02 PM

All replies

  • I don't have a copy of Blend 3 in front of me to try any of these (Blend 3 is several versions old now), but your xaml does seem like it should work. I tried it in Blend 4, and it worked as expected. I would expect similar results in Blend for VS 2012.

    #1 seems strange, what are you trying to right click that doesn't work? You should be able to right click elements either on the artboard or in the object tree.

    #2, the text editor in Blend is much more basic than the one in VS, as you can see. Fortunately now the designer in VS is based on the same code as Blend, so you can get the best of both worlds in VS.

    Friday, April 19, 2013 2:31 AM
    Moderator