<UserControl x:Class="Valg.EVA.Skanning.Verify.Startup.Preview.PreviewImageView"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
             xmlns:controls="clr-namespace:Ab2d.Controls;assembly=Ab2d.Controls.ZoomPanel"
             mc:Ignorable="d" 
             d:DesignHeight="300" d:DesignWidth="300">
    <Grid>
        <Grid MouseEnter="UIElement_OnMouseEnter" MouseLeave="UIElement_OnMouseLeave">
            <controls:ZoomPanel x:Name="ImageZoomPanel"
                                Viewbox="0.0 0.0 1.0 1.0"
                                RotationAngle="{Binding ElementName=RotationAngleSlider, Path=Value, Mode=TwoWay}"
                                IsMouseWheelZoomEnabled="True"  
                                IsAnimated="True" IsPanningAnimated="False" 
                                ZoomMode="Rectangle"
                                IsViewboxLimited="True"
                                ViewboxLimits="-0.5 -0.5 2 2">
                <Border BorderThickness="2" BorderBrush="{StaticResource ActiveElementBorderBrush}">
                    <Image>
                        <Image.Source>
                            <PriorityBinding>
                                <Binding IsAsync="True" />
                            </PriorityBinding>
                        </Image.Source>
                    </Image>
                </Border>
            </controls:ZoomPanel>
            <StackPanel Orientation="Vertical" HorizontalAlignment="Right" VerticalAlignment="Bottom" Visibility="Hidden" x:Name="ZoomPanelButtons">
                <StackPanel Orientation="Horizontal" HorizontalAlignment="Center" Margin="0,20,20,20">
                    <ToggleButton x:Name="MoveButton" Command="{x:Static controls:ZoomPanel.SetMoveModeCommand}" CommandTarget="{Binding ElementName=ImageZoomPanel}" Style="{StaticResource MoveImageButton}" Height="40" Width="40" Margin="0,0,0,0"></ToggleButton>
                    <ToggleButton x:Name="RectangleButton" Command="{x:Static controls:ZoomPanel.SetRectangleModeCommand}" CommandTarget="{Binding ElementName=ImageZoomPanel}" Style="{StaticResource RectangleButton}" Height="40" Width="40" Margin="8,0,0,0">Rectangle</ToggleButton>
                    <Button Command="{x:Static controls:ZoomPanel.ResetCommand}" CommandTarget="{Binding ElementName=ImageZoomPanel}" Style="{StaticResource ResetImageButton}" Height="40" Width="40" VerticalAlignment="Top" HorizontalAlignment="Right" Margin="8,0,0,0"></Button>
                </StackPanel>
            </StackPanel>
        </Grid>
    </Grid>
</UserControl>

