<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
                    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
                    xmlns:hc="clr-namespace:HandyControl.Controls"
                    xmlns:interactivity="clr-namespace:HandyControl.Interactivity"
                    xmlns:themes="clr-namespace:HandyControl.Themes">

    <ResourceDictionary.MergedDictionaries>
        <themes:SharedResourceDictionary Source="pack://application:,,,/HandyControl;component/Themes/Styles/Button.xaml"/>
        <themes:SharedResourceDictionary Source="pack://application:,,,/HandyControl;component/Themes/Styles/TextBlock.xaml"/>
        <themes:SharedResourceDictionary Source="pack://application:,,,/HandyControl;component/Themes/Styles/Border.xaml"/>
        <themes:SharedResourceDictionary Source="pack://application:,,,/HandyControl;component/Themes/Styles/ToggleButton.xaml"/>
        <themes:SharedResourceDictionary Source="pack://application:,,,/HandyControl;component/Themes/Basic/Converters.xaml"/>
        <themes:SharedResourceDictionary Source="pack://application:,,,/HandyControl;component/Themes/Basic/Paths.xaml"/>
    </ResourceDictionary.MergedDictionaries>

    <Style TargetType="hc:ImageViewer">
        <Setter Property="Focusable" Value="False"/>
        <Setter Property="Background" Value="Transparent"/>
        <Setter Property="MinWidth" Value="400"/>
        <Setter Property="MinHeight" Value="250"/>
        <Setter Property="BorderThickness" Value="1"/>
        <Setter Property="BorderBrush" Value="{DynamicResource BorderBrush}"/>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="hc:ImageViewer">
                    <Border BorderThickness="{TemplateBinding BorderThickness}" BorderBrush="{TemplateBinding BorderBrush}" Background="{TemplateBinding Background}">
                        <Grid>
                            <Grid.RowDefinitions>
                                <RowDefinition/>
                                <RowDefinition Height="Auto"/>
                            </Grid.RowDefinitions>
                            <hc:SimplePanel x:Name="PART_PanelMain" ClipToBounds="True" Grid.RowSpan="2">
                                <Border HorizontalAlignment="Left" VerticalAlignment="Top" Height="{TemplateBinding ImageHeight}" Width="{TemplateBinding ImageWidth}" Margin="{TemplateBinding ImageMargin}">
                                    <Image Name="PART_ImageMain" RenderOptions.BitmapScalingMode="NearestNeighbor" RenderTransformOrigin="0.5,0.5" Source="{TemplateBinding ImageSource}"/>
                                </Border>
                            </hc:SimplePanel>
                            <Border Grid.Row="0" Grid.RowSpan="2" Width="252" Height="162" HorizontalAlignment="Right" VerticalAlignment="Bottom" Background="{DynamicResource DarkOpacityBrush}" BorderBrush="{DynamicResource BorderBrush}" BorderThickness="1">
                                <Border.Visibility>
                                    <MultiBinding Converter="{StaticResource BooleanArr2VisibilityConverter}">
                                        <Binding RelativeSource="{RelativeSource TemplatedParent}" Path="ShowSmallImgInternal"/>
                                        <Binding RelativeSource="{RelativeSource TemplatedParent}" Path="ShowImgMap"/>
                                    </MultiBinding>
                                </Border.Visibility>
                                <Canvas ClipToBounds="True" Name="PART_CanvasSmallImg" MaxWidth="250" MaxHeight="160">
                                    <Border UseLayoutRounding="True" Name="PART_BorderMove" Background="Transparent" Width="50" Height="70" BorderThickness="1" BorderBrush="Black">
                                        <Border BorderThickness="1" BorderBrush="White"/>
                                    </Border>
                                </Canvas>
                            </Border>
                            <Border UseLayoutRounding="True" Name="PART_BorderBottom" Opacity="0" CornerRadius="4,4,0,0" Grid.Row="1" HorizontalAlignment="Center" Background="{DynamicResource DarkOpacityBrush}">
                                <StackPanel Margin="30,10" VerticalAlignment="Center" Orientation="Horizontal">
                                    <Button Command="interactivity:ControlCommands.Save" Margin="6,0" Style="{StaticResource ButtonIcon}" hc:IconElement.Geometry="{StaticResource SaveGeometry}" Padding="3"/>
                                    <Button Command="interactivity:ControlCommands.Open" Margin="6,0" Style="{StaticResource ButtonIcon}" hc:IconElement.Geometry="{StaticResource WindowsGeometry}" Padding="3"/>

                                    <Border Margin="10,2" Background="White" Style="{StaticResource BorderVerticallySplitter}"/>

                                    <Button Command="interactivity:ControlCommands.Reduce" Margin="6,0" Style="{StaticResource ButtonIcon}" hc:IconElement.Geometry="{StaticResource ReduceGeometry}" Padding="3"/>
                                    <TextBlock Margin="6,0" Text="{TemplateBinding ScaleStr}" Style="{StaticResource TextBlockSubTitle}" Foreground="{DynamicResource TextIconBrush}"/>
                                    <Button Command="interactivity:ControlCommands.Enlarge" Margin="6,0" Style="{StaticResource ButtonIcon}" hc:IconElement.Geometry="{StaticResource EnlargeGeometry}" Padding="3"/>
                                    <Button Command="interactivity:ControlCommands.Restore" Background="Transparent" Margin="6,0" Style="{StaticResource ButtonCustom}" Foreground="White">
                                        <Border BorderThickness="1" BorderBrush="White" Padding="2">
                                            <TextBlock Text="1:1"/>
                                        </Border>
                                    </Button>
                                    <Border Margin="10,2" Background="White" Style="{StaticResource BorderVerticallySplitter}"/>
                                    <Button Command="interactivity:ControlCommands.RotateLeft" CommandParameter="" Margin="6,0" Style="{StaticResource ButtonIcon}" hc:IconElement.Geometry="{StaticResource RotateLeftGeometry}" Padding="3"/>
                                    <Button Command="interactivity:ControlCommands.RotateRight" Margin="6,0,0,0" Style="{StaticResource ButtonIcon}" hc:IconElement.Geometry="{StaticResource RotateRightGeometry}" Padding="3"/>
                                    <ToggleButton Visibility="{TemplateBinding ShowFullScreenButton,Converter={StaticResource Boolean2VisibilityConverter}}" Foreground="{DynamicResource TextIconBrush}" IsChecked="{Binding IsFullScreen,RelativeSource={RelativeSource TemplatedParent},Mode=TwoWay}" Margin="12,0,6,0" Style="{StaticResource ToggleButtonIconTransparent}" hc:IconSwitchElement.Geometry="{StaticResource FullScreenGeometry}" hc:IconSwitchElement.GeometrySelected="{StaticResource FullScreenReturnGeometry}" Padding="3"/>

                                </StackPanel>
                            </Border>
                        </Grid>
                    </Border>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

</ResourceDictionary>