<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
                    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
                    xmlns:local="clr-namespace:DBInStudio.Desktop"
                    xmlns:viewmodel="clr-namespace:DBInStudio.Desktop.ViewModel"
                    xmlns:view="clr-namespace:DBInStudio.Desktop.View"
                    >

    <DataTemplate DataType="{x:Type viewmodel:LoginViewModel}">
        <view:LoginView />
    </DataTemplate>

    <DataTemplate DataType="{x:Type viewmodel:ListDatabaseViewModel}">
        <view:ListDatabaseView />
    </DataTemplate>

    <DataTemplate DataType="{x:Type viewmodel:NewDatabaseViewModel}">
        <view:NewDatabaseView />
    </DataTemplate>

    <DataTemplate DataType="{x:Type viewmodel:TagGroupDetailViewModel}">
        <view:TagGroupDetailView />
    </DataTemplate>

    <DataTemplate DataType="{x:Type viewmodel:DeadAreaCompressParameterViewModel}">
        <view:DeadAreaCompressParameter/>
    </DataTemplate>

    <DataTemplate DataType="{x:Type viewmodel:SlopeCompressParameterViewModel}">
        <view:SlopeCompressParameterView />
    </DataTemplate>


    <DataTemplate DataType="{x:Type viewmodel:UserGroupDetailViewModel}">
        <view:UserGroupDetailView />
    </DataTemplate>

    <DataTemplate DataType="{x:Type viewmodel:PermissionGroupManagerViewModel}">
        <view:PermissionGroupManagerView />
    </DataTemplate>

    <DataTemplate DataType="{x:Type viewmodel:PermissionDetailViewModel}">
        <view:PermissionDetailView />
    </DataTemplate>

    <DataTemplate DataType="{x:Type viewmodel:ImportModeSelectViewModel}">
        <view:ImportModeSelectView />
    </DataTemplate>

    <DataTemplate DataType="{x:Type viewmodel:ServerUserEditorViewModel}">
        <view:ServerUserEditorView />
    </DataTemplate>

    <DataTemplate DataType="{x:Type viewmodel:ServerUserManagerViewModel}">
        <view:ServerUserGroupDetailView />
    </DataTemplate>


    <DataTemplate DataType="{x:Type viewmodel:ConvertEditViewModel}">
        <view:ConvertEditView />
    </DataTemplate>

    <DataTemplate DataType="{x:Type viewmodel:LinearConvertViewModel}">
        <view:LinearConvertView />
    </DataTemplate>

    <DataTemplate DataType="{x:Type viewmodel:MarInfoViewModel}">
        <view:MarInfoView />
    </DataTemplate>

    <BooleanToVisibilityConverter x:Key="bvc" />
    
    


    <SolidColorBrush x:Key="Button.Static.Background" Color="#FFDDDDDD"/>
    <SolidColorBrush x:Key="Button.Static.Border" Color="#FF707070"/>
    <SolidColorBrush x:Key="Button.MouseOver.Background" Color="#FFBEE6FD"/>
    <SolidColorBrush x:Key="Button.MouseOver.Border" Color="#FF3C7FB1"/>
    <SolidColorBrush x:Key="Button.Pressed.Background" Color="#FFC4E5F6"/>
    <SolidColorBrush x:Key="Button.Pressed.Border" Color="#FF2C628B"/>
    <Style x:Key="ToggleButtonStyle1" TargetType="{x:Type ToggleButton}">
        <Setter Property="FocusVisualStyle" Value="{StaticResource FocusVisual}"/>
        <Setter Property="Background" Value="{StaticResource Button.Static.Background}"/>
        <Setter Property="BorderBrush" Value="{StaticResource Button.Static.Border}"/>
        <Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.ControlTextBrushKey}}"/>
        <Setter Property="BorderThickness" Value="1"/>
        <Setter Property="HorizontalContentAlignment" Value="Center"/>
        <Setter Property="VerticalContentAlignment" Value="Center"/>
        <Setter Property="Padding" Value="1"/>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type ToggleButton}">
                    <Border x:Name="border" Background="{TemplateBinding Background}" BorderThickness="{TemplateBinding BorderThickness}" BorderBrush="{TemplateBinding BorderBrush}" SnapsToDevicePixels="true">
                        <Grid>
                            <!--<ContentPresenter  x:Name="contentPresenter" Focusable="False" HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" Margin="{TemplateBinding Padding}" RecognizesAccessKey="True" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}"/>-->
                            <Image  x:Name="contentPresenter" Source="/DBInStudio;component/Image/hidden.png" Width="16" Height="8" Stretch="Fill" HorizontalAlignment="Center" VerticalAlignment="Center"   RenderOptions.BitmapScalingMode="NearestNeighbor"/>
                        </Grid>
                    </Border>
                    <ControlTemplate.Triggers>
                        <Trigger Property="Button.IsDefaulted" Value="true">
                            <Setter Property="BorderBrush" TargetName="border" Value="{DynamicResource {x:Static SystemColors.HighlightBrushKey}}"/>
                        </Trigger>
                        <Trigger Property="IsMouseOver" Value="true">
                            <Setter Property="Background" TargetName="border" Value="#1FFFFFFF"/>
                            <Setter Property="BorderBrush" TargetName="border" Value="{StaticResource Button.MouseOver.Border}"/>
                        </Trigger>
                        <Trigger Property="IsPressed" Value="true">
                            <Setter Property="Background" TargetName="border" Value="#1FFFFFFF"/>
                            <Setter Property="BorderBrush" TargetName="border" Value="{StaticResource Button.Pressed.Border}"/>
                        </Trigger>
                        <Trigger Property="IsChecked" Value="true">
                            <Setter Property="Source" TargetName="contentPresenter" Value="/DBInStudio;component/Image/show.png"/>
                            <Setter Property="Height" TargetName="contentPresenter" Value="16"/>
                            <Setter Property="Width" TargetName="contentPresenter" Value="24"/>
                        </Trigger>
                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>


    <Style x:Key="FocusVisual">
        <Setter Property="Control.Template">
            <Setter.Value>
                <ControlTemplate>
                    <Rectangle Margin="2" StrokeDashArray="1 2" SnapsToDevicePixels="true" StrokeThickness="1" Stroke="{DynamicResource {x:Static SystemColors.ControlTextBrushKey}}"/>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>
    
   
    <Style TargetType="{x:Type local:PasswordControl}">
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type local:PasswordControl}">
                    <Grid>
                        <Grid.ColumnDefinitions>
                            <ColumnDefinition Width="*" />
                            <ColumnDefinition Width="Auto" />
                        </Grid.ColumnDefinitions>
                        <PasswordBox  CaretBrush="White" x:Name="pb" Foreground="{TemplateBinding Foreground}"  Background="{TemplateBinding Background}" VerticalContentAlignment="Center" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}"  />
                        <TextBox  CaretBrush="White" Foreground="{TemplateBinding Foreground}"  Background="{TemplateBinding Background}" x:Name="tb" VerticalContentAlignment="Center"  Text="{Binding Password,Mode=TwoWay,RelativeSource={RelativeSource Mode=TemplatedParent}}" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" />
                        <ToggleButton Style="{StaticResource ToggleButtonStyle1}"  Background="Transparent" BorderThickness="0" Margin="10,0,0,0"  Grid.Column="1"   IsChecked="{Binding IsShowPassword,Mode=TwoWay,RelativeSource={RelativeSource Mode=TemplatedParent},UpdateSourceTrigger=PropertyChanged}" Width="30" Height="24" >
                            <Image Source="/Image/show.png" />
                        </ToggleButton>
                    </Grid>
                    
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <Style TargetType="{x:Type local:CustomWindowBase}">
        <Setter Property="IsOK" Value="{Binding IsOK}" />
        <Setter Property="IsCancel" Value="{Binding IsCancel}" />
        <Setter Property="Title" Value="{Binding Title}" />
        <Setter Property="IconString" Value="{Binding Icon}" />
        <Setter Property="Icon" Value="/Image/mrdbd.ico" />
        <Setter Property="IsClosed" Value="{Binding IsClosed}" />
        <Setter Property="SizeToContent" Value="WidthAndHeight" />
        <Setter Property="IsEnableMax" Value="{Binding IsEnableMax}" />
        <Setter Property="ShowInTaskbar" Value="False" />
        <Setter Property="IsHidden" Value="{Binding IsHidden}" />
        <Setter Property="UseLayoutRounding" Value="True" />
        <Setter Property="SnapsToDevicePixels" Value="True" />
        <!--<Setter Property="ResizeMode" Value="CanResizeWithGrip" />-->
        <Setter Property="Background" Value="#CF000000" />
        <Setter Property="Foreground" Value="{DynamicResource Window.Forground}" />
        <!--<Setter Property="ResizeMode" Value="{Binding IsEnableMax,Converter={StaticResource BoolToResize}}" />-->
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type local:CustomWindowBase}">
                    <Border BorderThickness="1" BorderBrush="DarkGray">
                    <Grid Background="{TemplateBinding Background}" x:Name="head" >
                        <Grid.RowDefinitions>
                            <RowDefinition Height="32" />
                            <RowDefinition Height="*" />
                            <RowDefinition Height="Auto" />
                        </Grid.RowDefinitions>
                          <Grid Background="#9F000000">
                            <Image Margin="5,0"  Source="{Binding Icon,RelativeSource={RelativeSource AncestorType=Window}}" Height="16" HorizontalAlignment="Left" Width="24" VerticalAlignment="Center" RenderOptions.BitmapScalingMode="HighQuality" Stretch="Fill" />
                            <Label Margin="30,0,115,0" VerticalContentAlignment="Center" Content="{Binding Title,RelativeSource={RelativeSource AncestorType=Window}}" Foreground="{Binding Foreground,RelativeSource={RelativeSource AncestorType=Window}}"/>
                            <StackPanel Orientation="Horizontal" HorizontalAlignment="Right">
                                <Button Style="{DynamicResource ButtonStyle1}" x:Name="minB" BorderThickness="0" Background="Transparent"   Command="{Binding ReloadCommand}" HorizontalAlignment="Left"  Margin="1,0,0,0"   VerticalAlignment="Stretch" Width="32"  >
                                    <Button.ContentTemplate>
                                        <DataTemplate>
                                            <StackPanel Orientation="Horizontal">
                                                <Image Source="/Image/minus.png" Height="12" RenderOptions.BitmapScalingMode="HighQuality" Stretch="Fill"/>
                                            </StackPanel>
                                        </DataTemplate>
                                    </Button.ContentTemplate>
                                </Button>

                                <Button Style="{DynamicResource ButtonStyle1}" x:Name="maxB" BorderThickness="0"  Background="Transparent" Command="{Binding ReloadCommand}" HorizontalAlignment="Left"  Margin="0,0,0,0"   VerticalAlignment="Stretch" Width="32"  >
                                    <Button.ContentTemplate>
                                        <DataTemplate>
                                            <StackPanel Orientation="Horizontal">
                                                <Image Source="/Image/max.png" Height="16" RenderOptions.BitmapScalingMode="HighQuality" Stretch="None" />
                                            </StackPanel>
                                        </DataTemplate>
                                    </Button.ContentTemplate>
                                </Button>

                                <Button Style="{DynamicResource ButtonStyle1}" x:Name="closeB" BorderThickness="0"  Background="Transparent"    HorizontalAlignment="Left"  Margin="0,0,0,0"   VerticalAlignment="Stretch" Width="32"  >
                                    <Button.ContentTemplate>
                                        <DataTemplate>
                                            <StackPanel Orientation="Horizontal">
                                                <Image Source="/Image/close.png" Height="16" RenderOptions.BitmapScalingMode="HighQuality" Stretch="None"/>
                                            </StackPanel>
                                        </DataTemplate>
                                    </Button.ContentTemplate>
                                </Button>
                            </StackPanel>
                        </Grid>
                            <Grid Background="#0FFFFFFF" Grid.Row="1">
                                <ContentControl  x:Name="content_host" Content="{Binding}" Margin="0" />
                            </Grid>
                            
                        <Border   Height="32"  Grid.Row="2" BorderBrush="Gray" BorderThickness="0,1,0,0"  Visibility="{Binding IsOkCancel,Converter={StaticResource bvc}}">
                            <Grid  Margin="0" >
                                <Label  Content="{Binding Message}" VerticalAlignment="Center" HorizontalAlignment="Left" Margin="0,0,200,0" />
                                    <Button  Style="{DynamicResource ButtonStyle1}" Name="btn_Cancel" BorderBrush="IndianRed" BorderThickness="0,0,0,2" IsCancel="{Binding IsEnableDefault}" Content="{local:ResMarker Cancel}" Height="22" Width="75" Margin="0,0,10,0" Command="{Binding CancelCommand}" HorizontalAlignment="Right" VerticalAlignment="Center"   >
                                    <Button.ContentTemplate>
                                        <DataTemplate>
                                            <StackPanel Orientation="Horizontal">
                                                <Image Source="/Image/cancel.png" Height="16" RenderOptions.BitmapScalingMode="NearestNeighbor"/>
                                                <TextBlock Text="{Binding}" VerticalAlignment="Center" Margin="5,0"/>
                                            </StackPanel>
                                        </DataTemplate>
                                    </Button.ContentTemplate>
                                </Button>
                                    <Button  Style="{DynamicResource ButtonStyle1}" BorderBrush="Green" BorderThickness="0,0,0,2" Name="btn_OK"  IsDefault="{Binding IsEnableDefault}" Content="{local:ResMarker OK}" Height="22" Width="75"  Margin="0,0,100,0" Command="{Binding OKCommand}" HorizontalAlignment="Right" >
                                    <Button.ContentTemplate>
                                        <DataTemplate>
                                            <StackPanel Orientation="Horizontal">
                                                <Image Source="/Image/ok.png" Height="16" RenderOptions.BitmapScalingMode="NearestNeighbor"/>
                                                <TextBlock Text="{Binding}" VerticalAlignment="Center" Margin="5,0"/>
                                            </StackPanel>
                                        </DataTemplate>
                                    </Button.ContentTemplate>
                                </Button>
                            </Grid>
                        </Border>
                    </Grid>
                    </Border>
                    <ControlTemplate.Triggers>
                        <DataTrigger Binding="{Binding IsOkCancel}" Value="False" >
                            <Setter TargetName="btn_OK" Property="IsDefault" Value="False" />
                            <Setter TargetName="btn_Cancel" Property="IsCancel" Value="False" />
                        </DataTrigger>
                    </ControlTemplate.Triggers>
                </ControlTemplate>

            </Setter.Value>

        </Setter>

    </Style>
</ResourceDictionary>