<Window x:Class="WPF_Przycisk.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>
        <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>

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