minimize maximize restore wpf buttons

Code Example - minimize maximize restore wpf buttons

                
                        <!--Close Button-->
<Button x:Name="Close" Style="{StaticResource TitleButton}"
        Command="{Binding Source={x:Static SystemCommands.CloseWindowCommand}}"
        CommandParameter="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type Window}}}">
    <Grid Width="30" Height="25">
        <Path x:Name="Cross" Data="M0,0 L1,1 M0,1 L1,0" Stretch="Fill" Width="8" Height="8"
              Stroke="{Binding Foreground, RelativeSource={RelativeSource AncestorType={x:Type Button}, Mode=FindAncestor}}" StrokeThickness="2" />
    </Grid>
</Button>

<!--Maximize Button-->
<Button x:Name="Maximize" Style="{StaticResource TitleButton}"
        Command="{Binding Source={x:Static SystemCommands.MaximizeWindowCommand}}"
        CommandParameter="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type Window}}}" >
    <Grid Width="30" Height="25">
        <Path Data="M0,1 L9,1 L9,8 L0,8 Z" Width="9" Height="8" VerticalAlignment="Center" HorizontalAlignment="Center"
              Stroke="{Binding Foreground, RelativeSource={RelativeSource AncestorType={x:Type Button}, Mode=FindAncestor}}" StrokeThickness="2"  />
    </Grid>
</Button>

<!--Restore Button-->
<Button x:Name="Restore" Visibility="Collapsed" Style="{StaticResource TitleButton}"
        Command="{Binding Source={x:Static SystemCommands.RestoreWindowCommand}}"
        CommandParameter="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type Window}}}">
    <Grid Width="30" Height="25" UseLayoutRounding="True" RenderTransform="1,0,0,1,.5,.5">
        <Path Data="M2,0 L8,0 L8,6 M0,3 L6,3 M0,2 L6,2 L6,8 L0,8 Z" Width="8" Height="8" VerticalAlignment="Center" HorizontalAlignment="Center"
              Stroke="{Binding Foreground, RelativeSource={RelativeSource AncestorType={x:Type Button}, Mode=FindAncestor}}" StrokeThickness="1"  />
    </Grid>
</Button>

<!--Minimize Button-->
<Button x:Name="Minimize" Style="{StaticResource TitleButton}"
        Command="{Binding Source={x:Static SystemCommands.MinimizeWindowCommand}}"
        CommandParameter="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type Window}}}">
    <Grid Width="30" Height="25">
        <Path Data="M9,0 L8,1 8,1 8,1 0,1 0,1 z" Width="9" Height="9" VerticalAlignment="Bottom" HorizontalAlignment="Center"
              Stroke="{Binding Foreground, RelativeSource={RelativeSource AncestorType={x:Type Button}, Mode=FindAncestor}}" StrokeThickness="2" />
    </Grid>
</Button>