<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
                    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">

    <Style TargetType="Button" x:Key="ButtonBase">

    </Style>
    <Style TargetType="Button" x:Key="CommandButton" BasedOn="{StaticResource ButtonBase}">
        <Style.Setters>
            <Setter Property="Height" Value="25"/>
        </Style.Setters>
    </Style>
    <Style TargetType="Button" x:Key="AddButton" BasedOn="{StaticResource CommandButton}">
        <Style.Setters>
            <Setter Property="Content" Value="Add"/>
            <Setter Property="Command" Value="{Binding Add}"/>
        </Style.Setters>
    </Style>
    <Style TargetType="Button" x:Key="EditButton" BasedOn="{StaticResource CommandButton}">
        <Style.Setters>
            <Setter Property="Content" Value="Edit"/>
            <Setter Property="Command" Value="{Binding Edit}"/>
        </Style.Setters>
    </Style>
    <Style TargetType="Button" x:Key="DeleteButton" BasedOn="{StaticResource CommandButton}">
        <Style.Setters>
            <Setter Property="Content" Value="Delete"/>
            <Setter Property="Command" Value="{Binding Delete}"/>
        </Style.Setters>
    </Style>
    <Style TargetType="Button" x:Key="CopyButton" BasedOn="{StaticResource CommandButton}">
        <Style.Setters>
            <Setter Property="Content" Value="Copy"/>
            <Setter Property="Command" Value="{Binding Copy}"/>
        </Style.Setters>
    </Style>
    <Style TargetType="Button" x:Key="OkButton" BasedOn="{StaticResource CommandButton}">
        <Style.Setters>
            <Setter Property="Content" Value="Ok"/>
            <Setter Property="IsDefault" Value="True"/>
            <Setter Property="Width" Value="60"/>
            <Setter Property="Margin" Value="5"/>
        </Style.Setters>
    </Style>
    <Style TargetType="Button" x:Key="CancelButton" BasedOn="{StaticResource CommandButton}">
        <Style.Setters>
            <Setter Property="Content" Value="Cancel"/>
            <Setter Property="IsCancel" Value="True"/>
            <Setter Property="Width" Value="60"/>
            <Setter Property="Margin" Value="5"/>
        </Style.Setters>
    </Style>

    <Style x:Key="ToolButton" TargetType="Button">
        <Style.Resources>
            <Style TargetType="Image">
                <Setter Property="Width" Value="32"/>
                <Setter Property="Height" Value="32"/>
                <Setter Property="Margin" Value="-2"/>
                <Setter Property="HorizontalAlignment" Value="Center"/>
                <Setter Property="VerticalAlignment" Value="Center"/>
                <Style.Triggers>
                    <Trigger Property="IsEnabled" Value="False">
                        <Setter Property="Opacity" Value="0.25"/>
                    </Trigger>
                </Style.Triggers>
            </Style>
            <Style TargetType="Viewbox">
                <Setter Property="Margin" Value="-2"/>
                <Setter Property="Width" Value="32"/>
                <Setter Property="Height" Value="32"/>
                <Setter Property="HorizontalAlignment" Value="Center"/>
                <Setter Property="VerticalAlignment" Value="Center"/>
                <Setter Property="Stretch" Value="UniformToFill"/>
                <Style.Triggers>
                    <Trigger Property="IsEnabled" Value="False">
                        <Setter Property="Opacity" Value="0.25"/>
                    </Trigger>
                </Style.Triggers>
            </Style>
        </Style.Resources>
        <Setter Property="Width" Value="32"/>
        <Setter Property="Height" Value="32"/>
        <Setter Property="Margin" Value="2,0,2,0"/>
        <Setter Property="Background" Value="#FFA19BC3"/>
        <Setter Property="BorderBrush" Value="Black"/>
    </Style>

    <Style x:Key="ButtonImage16" TargetType="Image">
        <Setter Property="Height" Value="16"/>
        <Setter Property="Width" Value="16"/>
    </Style>
    <Style x:Key="ButtonImage32" TargetType="Image">
        <Setter Property="Height" Value="32"/>
        <Setter Property="Width" Value="32"/>
    </Style>

    <Color x:Key="ButtonLight" A="255" B="255" G="255" R="255"/>
    <Color x:Key="CalculatorColor" A="255" B="149" G="149" R="211"/>
    <Color x:Key="CalculatorFrameColor" A="255" B="109" G="109" R="166"/>
    <SolidColorBrush x:Key="CalculatorCanvas" Color="{DynamicResource CalculatorColor}"/>
    <SolidColorBrush x:Key="CalculatorFrame" Color="{DynamicResource CalculatorFrameColor}"/>

    <Style x:Key="ButtonCanvas" TargetType="Canvas">
        <Setter Property="Width" Value="32"/>
        <Setter Property="Height" Value="32"/>
        <Setter Property="HorizontalAlignment" Value="Center"/>
        <Setter Property="VerticalAlignment" Value="Center"/>
    </Style>

    <Style x:Key="ButtonCalculatorCanvas" TargetType="Canvas" BasedOn="{StaticResource ButtonCanvas}">
        <Setter Property="Background" Value="{DynamicResource CalculatorCanvas}"/>
    </Style>

    <Style x:Key="ButtonRect" TargetType="Rectangle">
        <Setter Property="Margin" Value="3"/>
        <Setter Property="Width" Value="26"/>
        <Setter Property="Height" Value="26"/>
        <Setter Property="HorizontalAlignment" Value="Center"/>
        <Setter Property="VerticalAlignment" Value="Center"/>
        <Setter Property="StrokeThickness" Value="1"/>
    </Style>


    <DataTemplate x:Key="OkCancelButtons">
        <StackPanel Grid.Row="1" Orientation="Horizontal" HorizontalAlignment="Right">
            <Button Style="{StaticResource CancelButton}" Command="{Binding CancelCommand}"/>
            <Button Style="{StaticResource OkButton}" Command="{Binding OkCommand}"/>
        </StackPanel>
    </DataTemplate>

    <DataTemplate x:Key="ButtonCalculatorRectangle">              
    <Rectangle Style="{DynamicResource ButtonRect}" Stroke="{DynamicResource CalculatorFrame}">
        <Rectangle.Fill>
            <LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
                <GradientStop Color="{DynamicResource ButtonLight}" Offset="0.2"/>
                <GradientStop Color="{DynamicResource CalculatorColor}" Offset="1"/>
            </LinearGradientBrush>
        </Rectangle.Fill>
    </Rectangle>
    </DataTemplate>

    <DataTemplate x:Key="DiagramCalculator">
        <Canvas Style="{DynamicResource ButtonCalculatorCanvas}">
            <Canvas.Children>
                <ContentControl ContentTemplate="{DynamicResource ButtonCalculatorRectangle}"/>
                <Line Margin="4" X1="0" Y1="20" X2="25" Y2="20" StrokeThickness="1.5" Stroke="{DynamicResource CalculatorFrame}"/>
                <Line Margin="4" X1="4" Y1="0" X2="4" Y2="25" StrokeThickness="1.5" Stroke="{DynamicResource CalculatorFrame}"/>
                <Path Margin="4" Data="M 0 5 l 4 -4 l 7 4 l 7 6 l 2 4 l -2 7 l -2 2 " Stroke="{DynamicResource CalculatorFrame}"/>
                <TextBlock Margin="4,2,0,0" Text="M-N" Foreground="Black" FontSize="10" HorizontalAlignment="Stretch" FontWeight="Bold" />
            </Canvas.Children>
        </Canvas>
    </DataTemplate>

    <DataTemplate x:Key="CrackCalculator">
        <Canvas Style="{DynamicResource ButtonCalculatorCanvas}">
            <Canvas.Children>
                <ContentControl ContentTemplate="{DynamicResource ButtonCalculatorRectangle}"/>
                <Path Margin="4" Data="M 0 0 l 25 0 l 0 20
                      l -4 0
                      l -1 -5 l 1 -5 l -2 5 l -2 5
                      l -3 0
                      l 0 -5 l 0 -10 l -2 10 l -2 5
                      l -3 0
                      l -1 -5 l 1 -5 l -2 5 l -2 5
                      l -4 0" Fill="{DynamicResource CalculatorFrame}"/>
                <TextBlock Margin="4,2,0,0" Text="Crc" Foreground="White" FontSize="10" HorizontalAlignment="Stretch" FontWeight="Bold" />
            </Canvas.Children>
        </Canvas>
    </DataTemplate>

    <DataTemplate x:Key="CalculatorRun">
        <Canvas Style="{DynamicResource ButtonCalculatorCanvas}">
            <Canvas.Children>
                <ContentControl ContentTemplate="{DynamicResource ButtonCalculatorRectangle}"/>
                <Path Margin="4" Data="M 4 2 l 12 10 l -12 10 l 0 -20" Fill="{DynamicResource CalculatorFrame}"/>
            </Canvas.Children>
        </Canvas>
    </DataTemplate>
    
</ResourceDictionary>