Mega Code Archive

 
Categories / VB.Net Tutorial / WPF
 

Named Theme

<Window x: Class="WpfApplication1.Window1"     xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"     xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"     Title="Fun with Controls!" Height="265" Width="433">   <Window.Resources>     <Style x:Key ="MyFunkyTheme">       <Setter Property ="Button.FontSize" Value ="20"/>       <Setter Property ="Button.Background">         <Setter.Value>           <LinearGradientBrush StartPoint="0,0" EndPoint="1,1">             <GradientStop Color="Black" Offset="0" />             <GradientStop Color="Yellow" Offset="0.25" />             <GradientStop Color="Honeydew" Offset="0.75" />             <GradientStop Color ="Red" Offset="1" />           </LinearGradientBrush>         </Setter.Value>       </Setter>     </Style>   </Window.Resources>   <StackPanel>     <Button Height="80" Width = "100" Style ="{StaticResource MyFunkyTheme}" Content = "Button a"/>     <Button Height="80" Width = "100" Style ="{StaticResource MyFunkyTheme}" Content = "Button b"/>   </StackPanel> </Window>