<ResourceDictionary
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:customControl="clr-namespace:PDF_Office.CustomControl">
    <Style TargetType="{x:Type customControl:PathButton}">
        <Setter Property="IconOpacity" Value="1" />
        <Setter Property="IconMouseOverOpacity" Value="1" />
        <Setter Property="IconPressOpacity" Value="1" />
        <Setter Property="IconCheckedOpacity" Value="1" />
        <Setter Property="IsChecked" Value="false" />
        <Setter Property="Background" Value="Transparent" />
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type customControl:PathButton}">

                    <Border
                        Background="{TemplateBinding Background}"
                        BorderBrush="{TemplateBinding BorderBrush}"
                        BorderThickness="{TemplateBinding BorderThickness}">
                        <Grid x:Name="grid" Background="{TemplateBinding Background}">
                            <Border
                                x:Name="PART_Border"
                                Background="{TemplateBinding Background}"
                                BorderBrush="{TemplateBinding BorderBrush}"
                                BorderThickness="{TemplateBinding BorderThickness}"
                                CornerRadius="{TemplateBinding CornerRadius}" />

                            <Grid HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}">
                                <StackPanel
                                    Margin="{TemplateBinding Padding}"
                                    HorizontalAlignment="Center"
                                    VerticalAlignment="Center"
                                    Orientation="{TemplateBinding IconContentOrientation}">
                                    <Grid HorizontalAlignment="Center" VerticalAlignment="{TemplateBinding VerticalContentAlignment}">
                                        <Path
                                            x:Name="PART_Icon"
                                            Width="{TemplateBinding IconWidth}"
                                            Height="{TemplateBinding IconHeight}"
                                            Data="{TemplateBinding Icon}"
                                            Fill="{TemplateBinding IconFill}"
                                            Opacity="{TemplateBinding IconOpacity}" />
                                        <Path
                                            x:Name="PART_MouseOverIcon"
                                            Width="{TemplateBinding IconWidth}"
                                            Height="{TemplateBinding IconHeight}"
                                            Data="{TemplateBinding IconMouseOver}"
                                            Fill="{TemplateBinding IconMouseOverFill}"
                                            Opacity="{TemplateBinding IconMouseOverOpacity}"
                                            Visibility="Collapsed" />
                                        <Path
                                            x:Name="PART_PressIcon"
                                            Width="{TemplateBinding IconWidth}"
                                            Height="{TemplateBinding IconHeight}"
                                            Data="{TemplateBinding IconPress}"
                                            Fill="{TemplateBinding IconPressFill}"
                                            Opacity="{TemplateBinding IconPressOpacity}"
                                            Visibility="Collapsed" />
                                        <Path
                                            x:Name="PART_CheckedIcon"
                                            Width="{TemplateBinding IconWidth}"
                                            Height="{TemplateBinding IconHeight}"
                                            Data="{TemplateBinding IconChecked}"
                                            Fill="{TemplateBinding IconCheckedFill}"
                                            Opacity="{TemplateBinding IconCheckedOpacity}"
                                            Visibility="Collapsed" />
                                    </Grid>
                                    <TextBlock
                                        x:Name="PART_Content"
                                        Margin="{TemplateBinding IconContentMargin}"
                                        HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
                                        VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
                                        Foreground="{TemplateBinding Foreground}"
                                        SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"
                                        Text="{TemplateBinding Content}"
                                        TextTrimming="CharacterEllipsis" />
                                </StackPanel>
                                <ContentPresenter
                                    Margin="{TemplateBinding Padding}"
                                    HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
                                    VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
                                    Focusable="False"
                                    RecognizesAccessKey="True"
                                    SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" />
                            </Grid>
                        </Grid>
                    </Border>

                    <ControlTemplate.Triggers>
                        <Trigger Property="IsMouseOver" Value="True">
                            <Setter TargetName="PART_Content" Property="Foreground" Value="{Binding MouseOverForeground, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type customControl:PathButton}}}" />
                            <Setter TargetName="PART_Border" Property="Background" Value="{Binding MouseOverBackground, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type customControl:PathButton}}}" />
                            <Setter TargetName="PART_Border" Property="BorderBrush" Value="{Binding MouseOverBorderBrush, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type customControl:PathButton}}}" />
                            <Setter TargetName="PART_MouseOverIcon" Property="Visibility" Value="Visible" />
                            <Setter TargetName="PART_Icon" Property="Visibility" Value="Collapsed" />
                            <Setter TargetName="PART_PressIcon" Property="Visibility" Value="Collapsed" />
                            <Setter TargetName="PART_CheckedIcon" Property="Visibility" Value="Collapsed" />
                        </Trigger>

                        <Trigger Property="IsPressed" Value="True">
                            <Setter TargetName="PART_Content" Property="Foreground" Value="{Binding MouseDownForeground, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type customControl:PathButton}}}" />
                            <Setter TargetName="PART_Border" Property="Background" Value="{Binding MouseDownBackground, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type customControl:PathButton}}}" />
                            <Setter TargetName="PART_Border" Property="BorderBrush" Value="{Binding MouseDownBorderBrush, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type customControl:PathButton}}}" />
                            <Setter TargetName="PART_PressIcon" Property="Visibility" Value="Visible" />
                            <Setter TargetName="PART_Icon" Property="Visibility" Value="Collapsed" />
                            <Setter TargetName="PART_MouseOverIcon" Property="Visibility" Value="Collapsed" />
                            <Setter TargetName="PART_CheckedIcon" Property="Visibility" Value="Collapsed" />
                        </Trigger>

                        <Trigger Property="IsEnabled" Value="False">
                            <Setter Property="Opacity" Value="0.5" />
                        </Trigger>

                        <Trigger Property="IsChecked" Value="True">
                            <Setter TargetName="PART_Content" Property="Foreground" Value="{Binding MouseOverForeground, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type customControl:PathButton}}}" />
                            <Setter TargetName="PART_Border" Property="Background" Value="{Binding MouseOverBackground, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type customControl:PathButton}}}" />
                            <Setter TargetName="PART_Border" Property="BorderBrush" Value="{Binding MouseOverBorderBrush, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type customControl:PathButton}}}" />
                            <Setter TargetName="PART_MouseOverIcon" Property="Visibility" Value="Collapsed" />
                            <Setter TargetName="PART_Icon" Property="Visibility" Value="Collapsed" />
                            <Setter TargetName="PART_PressIcon" Property="Visibility" Value="Collapsed" />
                            <Setter TargetName="PART_CheckedIcon" Property="Visibility" Value="Visible" />
                        </Trigger>
                        <MultiTrigger>
                            <MultiTrigger.Conditions>
                                <Condition Property="IsMouseOver" Value="True" />
                                <Condition Property="IsChecked" Value="True" />
                            </MultiTrigger.Conditions>
                            <Setter TargetName="PART_Content" Property="Foreground" Value="{Binding MouseOverForeground, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type customControl:PathButton}}}" />
                            <Setter TargetName="PART_Border" Property="Background" Value="{Binding MouseOverBackground, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type customControl:PathButton}}}" />
                            <Setter TargetName="PART_Border" Property="BorderBrush" Value="{Binding MouseOverBorderBrush, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type customControl:PathButton}}}" />
                            <Setter TargetName="PART_MouseOverIcon" Property="Visibility" Value="Collapsed" />
                            <Setter TargetName="PART_Icon" Property="Visibility" Value="Collapsed" />
                            <Setter TargetName="PART_PressIcon" Property="Visibility" Value="Collapsed" />
                            <Setter TargetName="PART_CheckedIcon" Property="Visibility" Value="Visible" />
                        </MultiTrigger>
                        <MultiTrigger>
                            <MultiTrigger.Conditions>
                                <Condition Property="IsPressed" Value="True" />
                                <Condition Property="IsChecked" Value="True" />
                            </MultiTrigger.Conditions>
                            <Setter TargetName="PART_Content" Property="Foreground" Value="{Binding MouseOverForeground, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type customControl:PathButton}}}" />
                            <Setter TargetName="PART_Border" Property="Background" Value="{Binding MouseOverBackground, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type customControl:PathButton}}}" />
                            <Setter TargetName="PART_Border" Property="BorderBrush" Value="{Binding MouseOverBorderBrush, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type customControl:PathButton}}}" />
                            <Setter TargetName="PART_MouseOverIcon" Property="Visibility" Value="Collapsed" />
                            <Setter TargetName="PART_Icon" Property="Visibility" Value="Collapsed" />
                            <Setter TargetName="PART_PressIcon" Property="Visibility" Value="Collapsed" />
                            <Setter TargetName="PART_CheckedIcon" Property="Visibility" Value="Visible" />
                        </MultiTrigger>
                        <Trigger SourceName="PART_Content" Property="Text" Value="">
                            <Setter TargetName="PART_Content" Property="Visibility" Value="Collapsed" />
                        </Trigger>

                        <Trigger SourceName="PART_Content" Property="Text" Value="{x:Null}">
                            <Setter TargetName="PART_Content" Property="Visibility" Value="Collapsed" />
                        </Trigger>
                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>
</ResourceDictionary>