<UserControl x:Class="PixiEditor.Views.UserControls.FixedViewport"
             x:ClassModifier="internal"
             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:local="clr-namespace:PixiEditor.Views.UserControls"
             xmlns:converters="clr-namespace:PixiEditor.Helpers.Converters"
             mc:Ignorable="d"
             x:Name="uc"
             HorizontalAlignment="Center"
             VerticalAlignment="Center"
             d:DesignHeight="450" d:DesignWidth="800">
    <Image
        x:Name="mainImage"
        Focusable="True"
        Source="{Binding TargetBitmap, ElementName=uc}"
        HorizontalAlignment="Stretch"
        Stretch="Uniform"
        SizeChanged="OnImageSizeChanged">
        <RenderOptions.BitmapScalingMode>
            <MultiBinding Converter="{converters:WidthToBitmapScalingModeConverter}">
                <Binding ElementName="uc" Path="TargetBitmap.PixelWidth"/>
                <Binding ElementName="mainImage" Path="ActualWidth"/>
            </MultiBinding>
        </RenderOptions.BitmapScalingMode>
    </Image>
</UserControl>
