<Window x:Class="XamlWPF.MainWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
        xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
        xmlns:local="clr-namespace:XamlWPF"
        mc:Ignorable="d"
        Title="MainWindow" Height="350" Width="525">
    <Window.Resources>
        <LinearGradientBrush x:Key="NiebieskiGradient" StartPoint="0,0.5" EndPoint="1,0.5">
            <GradientStop Color="Blue" Offset="0.0" />
            <GradientStop Color="Navy" Offset="1.0" />
        </LinearGradientBrush>
        <LinearGradientBrush x:Key="FioletowyGradient" StartPoint="0,0.5" EndPoint="1,0.5">
            <GradientStop Color="Blue" Offset="0.0" />
            <GradientStop Color="BlueViolet" Offset="1.0" />
        </LinearGradientBrush>

        <ControlTemplate x:Key="SzablonNiebieski" TargetType="{x:Type Button}">
            <Grid>
                <Rectangle x:Name="tło" RadiusX="15" RadiusY="15" Fill="{StaticResource NiebieskiGradient}">
                    <Rectangle.BitmapEffect>
                        <OuterGlowBitmapEffect GlowColor="black" GlowSize="5"/>
                    </Rectangle.BitmapEffect>
                    <Rectangle.LayoutTransform>
                        <RotateTransform Angle="0" x:Name="obrót" />
                    </Rectangle.LayoutTransform>
                </Rectangle>
                <Viewbox>
                    <ContentPresenter Margin="10,10,10,10" />
                </Viewbox>
            </Grid>
            <ControlTemplate.Triggers>
                <Trigger Property="IsMouseOver" Value="True">
                    <Setter TargetName="tło" Property="Fill" Value="{StaticResource FioletowyGradient}" />
                    <Setter TargetName="tło" Property="BitmapEffect">
                        <Setter.Value>
                            <OuterGlowBitmapEffect GlowColor="Blue" GlowSize="5"/>
                        </Setter.Value>                        
                    </Setter>                    
                    <Trigger.EnterActions>
                        <BeginStoryboard>
                            <Storyboard>
                                <DoubleAnimation 
                                    Storyboard.TargetName="obrót"
                                    Storyboard.TargetProperty = "Angle"
                                    Duration="0:0:2"
                                    From="0" To="90" />
                            </Storyboard>
                        </BeginStoryboard>
                    </Trigger.EnterActions>
                </Trigger>
            </ControlTemplate.Triggers>
        </ControlTemplate>
    </Window.Resources>
    <StackPanel Orientation="Vertical">
        <Button x:Name="button" Margin="10,10,10,10"
                HorizontalAlignment="Center" VerticalAlignment="Center" 
                Width="200" Height="100" 
                Template="{StaticResource SzablonNiebieski}">
            <StackPanel Orientation="Horizontal">
                <Image Width ="70" Height="70" Source="logo.gif" />
                <Rectangle Width="10" />
                <TextBlock FontSize="16" Foreground="White">
                    <Run Foreground="Yellow">Uniwersystet</Run><LineBreak/>
                    Mikołaja<LineBreak/>
                    Kopernika
                </TextBlock>
            </StackPanel>
        </Button>        
        <Button Content="Przycisk" Foreground="White" Width="100" Height="50" Margin="0,0,0,10" Template="{StaticResource SzablonNiebieski}" />
        <Button Content="Przycisk" Foreground="White" Width="100" Height="50" Margin="0,0,0,10" Template="{StaticResource SzablonNiebieski}" />
        <Button Content="Przycisk" Foreground="White" Width="100" Height="50" Margin="0,0,0,10" Template="{StaticResource SzablonNiebieski}" />
    </StackPanel>
</Window>
