Background Bling

Dancing Buttons




WPF Tutorial Contents

APL  Home Page



Background Bling

Tired of uniform backgrounds?  Then try a little gradient...

 <Window.Background>
      <LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
         <GradientStop Color="#FFB7B750" Offset="0" />
         <GradientStop Color="#FFF5F416" Offset="0.599" />
      </LinearGradientBrush>
 </Window.Background>

Dancing Buttons


Your user has an attention-deficit problem, so you need to make buttons look different (change the foreground colour and make them a bit taller as the mouse passes over)...

<Window
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    Title="Expanding Buttons">
  <StackPanel VerticalAlignment="Bottom" Orientation="Horizontal" Height="100">
  <StackPanel.Resources>
   <Style x:Key="buttonStyle" TargetType="{x:Type Button}">
   <Style.Triggers>
   <Trigger Property="IsMouseOver" Value="True">
    <Setter Property="RenderTransform" >
     <Setter.Value>
     <ScaleTransform ScaleY="1.25" CenterY="50" />
     </Setter.Value>
    </Setter>
    <Setter Property="Foreground" Value="Red"/>
   </Trigger>
   </Style.Triggers>
  <Setter Property="Height"  Value="50" />
  <Setter Property="Width"  Value="100" />
  </Style> 
  </StackPanel.Resources >
    <Button Content="Button A" Style="{StaticResource buttonStyle}" />
    <Button Content="Button B" Style="{StaticResource buttonStyle}" />
    <Button Content="Button C" Style="{StaticResource buttonStyle}" />
    </StackPanel>
</Window>


Haven't figured out yet how to make all the other controls move to make room (I suppose it's possible).