<Window x:Class="WpfApplication14jan.Window1" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" Title="Window1" Height="300" Width="300"> <Window.Resources> <Style x:Key="One" TargetType="{x:Type Button}"> <Setter Property="Foreground" Value="Green"/> </Style> <!-- This is how the style inheritance is implemented--> <Style x:Key="Two" BasedOn="{StaticResource One}" TargetType="{x:Type Button}"> <Setter Property="Background" Value="Yellow"/> </Style> </Window.Resources> <Button Height="100" Width="100" Style="{StaticResource Two}" Content="Welcome"> </Button> </Window>
<Window x:Class="WpfApplication14jan.Window1" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" Title="Window1" Height="300" Width="300"> </Window>
<Window x:Class="WpfApplication14jan.Window1" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" Title="Window1" Height="300" Width="300" Loaded="Window_Loaded"> <Grid Name="dd"> <Button Name="button1" Click="Clicked">In Line code!</Button> <x:Code> <![CDATA[ void Clicked(object sender, RoutedEventArgs e) { button1.Content = "WPF Inline Code"; } ]]> </x:Code> </Grid> </Window>