<Window
    x:Class="PDF_Office.Views.MainWindow"
    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:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:dragablz="http://dragablz.net/winfx/xaml/dragablz"
    xmlns:i="http://schemas.microsoft.com/xaml/behaviors"
    xmlns:local="clr-namespace:PDF_Office"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    xmlns:prism="http://prismlibrary.com/"
    xmlns:viewmodels="clr-namespace:PDF_Office.ViewModels"
    Width="1280"
    Height="800"
    MinWidth="540"
    MinHeight="460"
    prism:ViewModelLocator.AutoWireViewModel="True"
    Activated="Window_Activated"
    Closed="Window_Closed"
    Style="{StaticResource WindowStyle}"
    UseLayoutRounding="True"
    WindowStartupLocation="CenterScreen"
    mc:Ignorable="d">
    <Window.Resources>
        <ResourceDictionary>
            <Style x:Key="DragablzItemStyle" TargetType="{x:Type dragablz:DragablzItem}">
                <Setter Property="WindowChrome.IsHitTestVisibleInChrome" Value="True" />
                <Setter Property="Template">
                    <Setter.Value>
                        <ControlTemplate TargetType="dragablz:DragablzItem">
                            <Grid x:Name="templateRoot">
                                <Grid.ColumnDefinitions>
                                    <ColumnDefinition Width="*" />
                                    <ColumnDefinition Width="auto" />
                                </Grid.ColumnDefinitions>
                                <Border
                                    x:Name="Title"
                                    Width="184"
                                    Height="28"
                                    Margin="4,0,0,2"
                                    BorderBrush="#A0A2AE"
                                    BorderThickness="1,1,1,0"
                                    CornerRadius="5,5,0,0"
                                    WindowChrome.IsHitTestVisibleInChrome="True">
                                    <Grid Background="Transparent">
                                        <Grid.ColumnDefinitions>
                                            <ColumnDefinition Width="auto" />
                                            <ColumnDefinition Width="*" MinWidth="10" />
                                            <ColumnDefinition Width="auto" />
                                        </Grid.ColumnDefinitions>
                                        <TextBlock
                                            x:Name="TextTitle"
                                            MaxWidth="145"
                                            Margin="8,4,0,4"
                                            FontFamily="Segoe UI,Microsoft YaHei"
                                            Text="{Binding DataContext.FileName}"
                                            TextTrimming="WordEllipsis" />
                                        <Thumb
                                            x:Name="PART_Thumb"
                                            Grid.ColumnSpan="2"
                                            HorizontalAlignment="Stretch"
                                            VerticalContentAlignment="Stretch"
                                            Background="Transparent"
                                            FontFamily="Segoe UI,Microsoft YaHei"
                                            ToolTip="{Binding DataContext.FileName}">
                                            <Thumb.Template>
                                                <ControlTemplate>
                                                    <Grid Background="Transparent" />
                                                </ControlTemplate>
                                            </Thumb.Template>
                                        </Thumb>
                                        <TextBlock
                                            x:Name="ChangeIcon"
                                            Grid.Column="1"
                                            Width="5"
                                            Margin="3,4,2,0"
                                            HorizontalAlignment="Left"
                                            VerticalAlignment="Top"
                                            IsHitTestVisible="False"
                                            Text="*"
                                            Visibility="{Binding DataContext.FileChanged}" />
                                        <Button
                                            Grid.Column="2"
                                            Width="16"
                                            Height="16"
                                            Margin="0,4,8,4"
                                            Background="Transparent"
                                            BorderThickness="0"
                                            Command="{Binding DataContext.CloseTab}"
                                            CommandParameter="{Binding}"
                                            Content="X" />
                                    </Grid>
                                </Border>
                            </Grid>
                            <ControlTemplate.Triggers>
                                <Trigger Property="IsSelected" Value="True">
                                    <Setter TargetName="Title" Property="Background" Value="#FFFFFF" />
                                    <Setter TargetName="Title" Property="BorderThickness" Value="1,1,1,0" />
                                    <Setter TargetName="TextTitle" Property="Foreground" Value="#477EDE" />
                                    <Setter TargetName="ChangeIcon" Property="Foreground" Value="#477EDE" />
                                </Trigger>
                                <Trigger Property="IsSelected" Value="False">
                                    <Setter TargetName="Title" Property="Background" Value="TransParent" />
                                    <Setter TargetName="Title" Property="BorderThickness" Value="1,1,1,0" />
                                    <Setter TargetName="TextTitle" Property="Foreground" Value="#666666" />
                                    <Setter TargetName="ChangeIcon" Property="Foreground" Value="#666666" />
                                    <!--<Setter TargetName="btnPath" Property="Path.Fill" Value="#FF666666"/>-->
                                </Trigger>
                                <MultiDataTrigger>
                                    <MultiDataTrigger.Conditions>
                                        <Condition Binding="{Binding IsSelected, RelativeSource={RelativeSource Self}}" Value="false" />
                                        <Condition Binding="{Binding IsMouseOver, RelativeSource={RelativeSource Self}}" Value="true" />
                                    </MultiDataTrigger.Conditions>
                                    <Setter TargetName="Title" Property="Background" Value="#0D000000" />
                                    <Setter TargetName="TextTitle" Property="Foreground" Value="black" />
                                    <Setter TargetName="ChangeIcon" Property="Foreground" Value="black" />
                                    <!--<Setter TargetName="btnPath" Property="Path.Fill" Value="Black"/>-->
                                </MultiDataTrigger>
                            </ControlTemplate.Triggers>
                        </ControlTemplate>
                    </Setter.Value>
                </Setter>
            </Style>
        </ResourceDictionary>
    </Window.Resources>
    <Border>
        <Grid>
            <Grid.RowDefinitions>
                <RowDefinition Height="40" />
                <RowDefinition Height="65*" />
                <RowDefinition Height="121*"/>
            </Grid.RowDefinitions>
            <dragablz:TabablzControl
                Name="TabablzControl"
                Grid.RowSpan="3"
                BorderThickness="0"
                ItemContainerStyle="{StaticResource DragablzItemStyle}"
                SelectedItem="{Binding SelectedItem, Mode=TwoWay}">
                <dragablz:TabablzControl.InterTabController>
                    <dragablz:InterTabController InterTabClient="{Binding InterTabClient}" />
                </dragablz:TabablzControl.InterTabController>
                <dragablz:TabablzControl.HeaderSuffixContent>
                    <Button
                        x:Name="BtnAdd"
                        Width="16"
                        Height="16"
                        Margin="9,7,200,5"
                        HorizontalAlignment="Left"
                        Background="Transparent"
                        BorderThickness="0"
                        Command="{Binding AddTab}"
                        Content="+"
                        WindowChrome.IsHitTestVisibleInChrome="True" />
                </dragablz:TabablzControl.HeaderSuffixContent>
                <dragablz:TabablzControl.HeaderPrefixContent>
                    <Grid
                        Width="16"
                        Height="38"
                        Margin="0,2,0,0"
                        Background="Transparent" />
                </dragablz:TabablzControl.HeaderPrefixContent>
            </dragablz:TabablzControl>
            <!--  标题栏右侧栏，关闭按钮，会员，试用等  -->
            <StackPanel
                HorizontalAlignment="Left"
                Orientation="Horizontal"
                WindowChrome.IsHitTestVisibleInChrome="True" Margin="1160,0,0,0">
                <Button
                    Name="BtnMiniSize"
                    Width="40"
                    Height="40"
                    Click="BtnMiniSize_Click"
                    Content="--" />
                <Button
                    Name="BtnReStore"
                    Width="40"
                    Height="40"
                    Click="BtnReStore_Click" />
                <Button
                    Name="BtnClose"
                    Width="40"
                    Height="40"
                    Click="BtnClose_Click"
                    Content="X" />
            </StackPanel>
        </Grid>
    </Border>
</Window>
