<ResourceDictionary
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:cus="clr-namespace:PDF_Office.CustomControl"
    xmlns:local="clr-namespace:PDF_Office">

    <!--  style for customControl  -->
    <Style TargetType="{x:Type cus:DialogContent}">
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type cus:DialogContent}">
                    <Border Background="White" CornerRadius="8">
                        <Grid Background="Transparent">
                            <Grid.RowDefinitions>
                                <RowDefinition Height="50" />
                                <RowDefinition Height="*" />
                                <RowDefinition Height="64" />
                            </Grid.RowDefinitions>
                            <Border Background="Transparent">
                                <TextBlock
                                    Margin="16,0"
                                    VerticalAlignment="Center"
                                    FontSize="16"
                                    FontWeight="SemiBold"
                                    Text="{TemplateBinding Header}" />
                            </Border>
                            <ContentPresenter
                                Grid.Row="1"
                                Content="{TemplateBinding Content}"
                                Focusable="False"
                                RecognizesAccessKey="True"
                                SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" />
                            <Border Grid.Row="2">
                                <ContentControl Content="{TemplateBinding BottmBar}" />
                            </Border>
                        </Grid>
                    </Border>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <Style TargetType="{x:Type cus:TextBoxEx}">
        <Setter Property="Background" Value="{StaticResource color.field.bg.def}" />
        <Setter Property="BorderBrush" Value="{StaticResource color.field.border.norm}" />
        <Setter Property="Foreground" Value="Black" />
        <Setter Property="VerticalContentAlignment" Value="Center" />
        <Setter Property="BorderThickness" Value="1" />
        <Setter Property="FocusVisualStyle" Value="{x:Null}" />
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type cus:TextBoxEx}">
                    <Border
                        x:Name="border"
                        Width="{TemplateBinding Width}"
                        Height="32"
                        Background="{TemplateBinding Background}"
                        BorderBrush="{TemplateBinding BorderBrush}"
                        BorderThickness="{TemplateBinding BorderThickness}"
                        CornerRadius="{TemplateBinding CornerRadius}"
                        SnapsToDevicePixels="True">
                        <Grid Margin="{TemplateBinding Padding}">
                            <TextBlock
                                x:Name="placeholder"
                                Margin="{Binding ElementName=PART_ContentHost, Path=Margin}"
                                Padding="{TemplateBinding Padding}"
                                VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
                                FontSize="{TemplateBinding FontSize}"
                                Foreground="{TemplateBinding PlaceholderForeground}"
                                Text="{TemplateBinding PlaceholderText}"
                                Visibility="Collapsed" />

                            <ScrollViewer
                                x:Name="PART_ContentHost"
                                Margin="8,0,25,0"
                                Focusable="false"
                                Foreground="{TemplateBinding Foreground}"
                                HorizontalScrollBarVisibility="Hidden"
                                SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"
                                Style="{x:Null}"
                                VerticalScrollBarVisibility="Hidden" />
                            <Button
                                Name="PART_BtnClear"
                                Width="16"
                                Height="16"
                                Margin="9,0"
                                HorizontalAlignment="Right"
                                VerticalAlignment="Center"
                                Background="Transparent"
                                BorderThickness="0"
                                Style="{StaticResource NoColorBtn}"
                                Visibility="Collapsed">
                                <Path
                                    Data="M8 15C11.866 15 15 11.866 15 8C15 4.13401 11.866 1 8 1C4.13401 1 1 4.13401 1 8C1 11.866 4.13401 15 8 15ZM11.5303 5.53038L9.06069 8L11.5303 10.4696L10.4697 11.5303L8.00002 9.06066L5.53033 11.5303L4.46967 10.4697L6.93936 8L4.46967 5.53033L5.53033 4.46967L8.00002 6.93934L10.4697 4.46971L11.5303 5.53038Z"
                                    Fill="#CED0D4"
                                    Stretch="Uniform" />
                            </Button>
                        </Grid>
                    </Border>
                    <ControlTemplate.Triggers>
                        <Trigger Property="IsEnabled" Value="false">
                            <Setter TargetName="border" Property="Opacity" Value="0.56" />
                        </Trigger>
                        <Trigger Property="Text" Value="{x:Null}">
                            <Setter TargetName="placeholder" Property="Visibility" Value="Visible" />
                        </Trigger>
                        <Trigger Property="IsMouseOver" Value="True">
                            <Setter TargetName="PART_BtnClear" Property="Visibility" Value="Visible" />
                            <Setter Property="BorderBrush" Value="{StaticResource color.field.border.hov}" />
                        </Trigger>
                        <Trigger Property="IsFocused" Value="True">
                            <Setter TargetName="PART_BtnClear" Property="Visibility" Value="Visible" />
                            <Setter Property="BorderBrush" Value="{StaticResource color.field.border.focus}" />
                            <Setter TargetName="border" Property="Effect" Value="{StaticResource shadow.blue-0-4}" />
                        </Trigger>
                        <MultiTrigger>
                            <MultiTrigger.Conditions>
                                <Condition Property="IsFocused" Value="True" />
                                <Condition Property="IsError" Value="True" />
                            </MultiTrigger.Conditions>
                            <MultiTrigger.Setters>
                                <Setter TargetName="border" Property="Effect" Value="{StaticResource shadow.error.s}" />
                            </MultiTrigger.Setters>
                        </MultiTrigger>
                        <Trigger Property="IsError" Value="True">
                            <Setter Property="BorderBrush" Value="{StaticResource color.sys.border.error}" />
                        </Trigger>
                        <Trigger Property="Text" Value="">
                            <Setter TargetName="placeholder" Property="Visibility" Value="Visible" />
                            <Setter TargetName="PART_BtnClear" Property="Visibility" Value="Collapsed" />
                        </Trigger>
                        <MultiTrigger>
                            <MultiTrigger.Conditions>
                                <Condition Property="Text" Value="" />
                                <Condition Property="IsMouseOver" Value="True" />
                            </MultiTrigger.Conditions>
                            <MultiTrigger.Setters>
                                <Setter TargetName="PART_BtnClear" Property="Visibility" Value="Collapsed" />
                            </MultiTrigger.Setters>
                        </MultiTrigger>
                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
        <Style.Triggers>
            <MultiTrigger>
                <MultiTrigger.Conditions>
                    <Condition Property="IsInactiveSelectionHighlightEnabled" Value="true" />
                    <Condition Property="IsSelectionActive" Value="false" />
                </MultiTrigger.Conditions>
                <Setter Property="SelectionBrush" Value="{DynamicResource {x:Static SystemColors.InactiveSelectionHighlightBrushKey}}" />
            </MultiTrigger>
        </Style.Triggers>
    </Style>

    <Style TargetType="{x:Type cus:MenuItemWithPath}">
        <Setter Property="Foreground" Value="{StaticResource color.sys.text.neutral.lv1}" />
        <Setter Property="Background" Value="Transparent" />
        <Setter Property="Height" Value="32" />
        <Setter Property="Margin" Value="8,0" />
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type cus:MenuItemWithPath}">
                    <Border
                        x:Name="Border"
                        Background="{TemplateBinding Background}"
                        BorderBrush="{TemplateBinding BorderBrush}"
                        BorderThickness="0"
                        CornerRadius="7">
                        <Grid>
                            <Grid.ColumnDefinitions>
                                <ColumnDefinition
                                    x:Name="ColIcon"
                                    Width="Auto"
                                    SharedSizeGroup="MenuItemIconColumnGroup" />
                                <ColumnDefinition Width="Auto" SharedSizeGroup="MenuTextColumnGroup" />
                                <ColumnDefinition Width="Auto" SharedSizeGroup="MenuItemIGTColumnGroup" />
                                <ColumnDefinition x:Name="ColNext" Width="auto" />
                            </Grid.ColumnDefinitions>
                            <Path
                                x:Name="Icon"
                                Grid.Column="0"
                                Width="{TemplateBinding PathWidth}"
                                Height="{TemplateBinding PathHeight}"
                                Margin="5,0"
                                Data="{TemplateBinding Path}"
                                Fill="{TemplateBinding Foreground}" />
                            <Grid
                                x:Name="GlyphPanel"
                                Grid.Column="0"
                                Margin="5,0"
                                VerticalAlignment="Center"
                                Visibility="Collapsed">
                                <Viewbox
                                    Width="18"
                                    Height="18"
                                    VerticalAlignment="Center"
                                    FlowDirection="LeftToRight">
                                    <Path Data="M422.36247 839.786465c-13.320377 13.421684-34.909068 13.421684-48.126091 0l-10.69355-10.800997 0 0-11.398608-11.502985-50.145074-50.544163c-0.097214-0.201591 0-0.500397-0.201591-0.604774L72.380494 533.085224c-13.320377-13.421684-13.320377-35.218106 0-48.535413l72.132854-72.842005c13.319353-13.408381 34.907021-13.408381 48.224328 0l205.814506 209.252815L831.363631 184.208419c13.218046-13.414521 34.806737-13.414521 48.124044 0l72.134901 72.842005c13.317307 13.408381 13.317307 35.113729 0 48.52211L422.36247 839.786465 422.36247 839.786465z" Fill="{TemplateBinding Foreground}" />
                                </Viewbox>
                            </Grid>
                            <ContentPresenter
                                x:Name="HeaderHost"
                                Grid.Column="1"
                                Margin="{TemplateBinding Padding}"
                                VerticalAlignment="Center"
                                ContentSource="Header"
                                RecognizesAccessKey="True" />
                            <ContentPresenter
                                x:Name="IGTHost"
                                Grid.Column="2"
                                Margin="8,0"
                                VerticalAlignment="Center"
                                ContentSource="InputGestureText" />
                            <Grid
                                x:Name="ArrowPanel"
                                Grid.Column="3"
                                Margin="10,0"
                                HorizontalAlignment="Right"
                                VerticalAlignment="Center">
                                <Path
                                    x:Name="ArrowPanelPath"
                                    HorizontalAlignment="Right"
                                    VerticalAlignment="Center"
                                    Data="M0,0 L0,8 L4,4 z"
                                    Fill="{TemplateBinding Foreground}" />
                            </Grid>
                            <Popup
                                x:Name="SubMenuPopup"
                                AllowsTransparency="True"
                                Focusable="false"
                                IsOpen="{Binding Path=IsSubmenuOpen, RelativeSource={RelativeSource TemplatedParent}}"
                                Placement="Right">
                                <Border
                                    x:Name="SubMenuBorder"
                                    Padding="2,2,2,2"
                                    Background="#1D1D1D"
                                    BorderBrush="#999999"
                                    BorderThickness="0"
                                    CornerRadius="7">
                                    <Grid x:Name="SubMenu" Grid.IsSharedSizeScope="True">
                                        <StackPanel IsItemsHost="True" KeyboardNavigation.DirectionalNavigation="Cycle" />
                                    </Grid>
                                </Border>
                            </Popup>
                        </Grid>
                    </Border>
                    <ControlTemplate.Triggers>
                        <Trigger Property="Role" Value="TopLevelHeader">
                            <Setter Property="Padding" Value="6,1" />
                            <Setter Property="Background" Value="Transparent" />
                            <Setter TargetName="SubMenuPopup" Property="Placement" Value="Bottom" />
                            <Setter TargetName="ColIcon" Property="MinWidth" Value="0" />
                            <Setter TargetName="ColNext" Property="Width" Value="Auto" />
                            <Setter TargetName="Icon" Property="Visibility" Value="Collapsed" />
                            <Setter TargetName="GlyphPanel" Property="Visibility" Value="Collapsed" />
                            <Setter TargetName="IGTHost" Property="Visibility" Value="Collapsed" />
                            <Setter TargetName="ArrowPanel" Property="Visibility" Value="Collapsed" />
                        </Trigger>
                        <Trigger Property="IsHighlighted" Value="true">
                            <Setter TargetName="Border" Property="Background" Value="{StaticResource color.item-state.sel.bg.lv1}" />
                            <Setter Property="Foreground" Value="{StaticResource color.sys.text.accent.norm}" />
                        </Trigger>
                        <MultiTrigger>
                            <MultiTrigger.Conditions>
                                <Condition Property="IsHighlighted" Value="True" />
                                <Condition Property="Role" Value="TopLevelHeader" />
                            </MultiTrigger.Conditions>
                            <MultiTrigger.Setters>
                                <Setter TargetName="Border" Property="Background" Value="#0cffffff" />
                            </MultiTrigger.Setters>
                        </MultiTrigger>
                        <Trigger Property="Role" Value="TopLevelItem">
                            <Setter Property="Padding" Value="6,1" />
                            <Setter TargetName="ArrowPanel" Property="Visibility" Value="Collapsed" />
                        </Trigger>
                        <Trigger Property="Role" Value="SubmenuHeader">
                            <Setter Property="Padding" Value="5,2" />
                        </Trigger>
                        <Trigger Property="Path" Value="{x:Null}">
                            <Setter TargetName="Icon" Property="Visibility" Value="Collapsed" />
                        </Trigger>
                        <Trigger Property="Role" Value="SubmenuItem">
                            <Setter Property="Padding" Value="5,2" />
                            <Setter TargetName="ArrowPanel" Property="Visibility" Value="Collapsed" />
                        </Trigger>
                        <Trigger Property="IsChecked" Value="true">
                            <Setter TargetName="GlyphPanel" Property="Visibility" Value="Visible" />
                            <Setter TargetName="Icon" Property="Visibility" Value="Collapsed" />
                        </Trigger>

                        <Trigger Property="IsEnabled" Value="false">
                            <Setter Property="Foreground" Value="{StaticResource color.sys.text.neutral.dis}" />
                        </Trigger>
                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>
</ResourceDictionary>
