Как правильно отмасштабировать бордер и его содержимое?

Есть следующая разметка:

<Page x:Class="ConvertToImage.Pages.ConvertImagePage"
          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:ConvertToImage.Pages"
          xmlns:fa="http://schemas.awesome.incremented/wpf/xaml/fontawesome.sharp" 
          mc:Ignorable="d" Loaded="Page_Loaded" 
          d:DesignHeight="450" d:DesignWidth="800"
          Title="ConvertImagePage">


    <!--<Viewbox  ClipToBounds="True" >-->

    <Grid Style="{DynamicResource GridBackgroundBrush}" Height="auto" Margin="10 0 10 0">
        <WrapPanel HorizontalAlignment="Center" Margin="0 8 0 0">
            <TextBlock  Margin="0 10 0 0"  FontSize="20"
                                Text="Конвертировать форматы .png,"  Style="{DynamicResource textType}"/>
            <TextBlock Text=".raw, .gif," Margin="10 10 0 0"  FontSize="20" Style="{DynamicResource textType}"/>
            <TextBlock Text=".bmp, .tiff в jpg"  Margin="10 10 0 0"  FontSize="20" Style="{DynamicResource textType}"/>
        </WrapPanel>
        <StackPanel Orientation="Horizontal" VerticalAlignment="Center" HorizontalAlignment="Center">
            <Border
                            Width="auto" Height="auto" Margin="0 110 0 90"
                            Style="{DynamicResource bodredMeny}" Visibility="Visible">
                <Grid>
                    <Border CornerRadius="20" Height="auto" Width="auto"   Background="#FFEEB25F"
                                Margin="30 20 30 70" x:Name="borderContent" AllowDrop="True"
                              >
                        <Border Background="Transparent" 
                                    BorderThickness="1"
                                    CornerRadius="20" Margin="10">
                            <Border.Style>
                                <Style TargetType="Border">
                                    <Setter Property="BorderBrush" Value="Transparent"/>
                                    <Style.Triggers>
                                        <EventTrigger RoutedEvent="UIElement.DragEnter">
                                            <BeginStoryboard>
                                                <Storyboard>
                                                    <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="BorderBrush">
                                                        <DiscreteObjectKeyFrame KeyTime="0:0:0">
                                                            <DiscreteObjectKeyFrame.Value>
                                                                <DrawingBrush Viewport="0,0,8,8" ViewportUnits="Absolute" TileMode="Tile">
                                                                    <DrawingBrush.Drawing>
                                                                        <DrawingGroup>
                                                                            <GeometryDrawing Brush="Black">
                                                                                <GeometryDrawing.Geometry>
                                                                                    <GeometryGroup>
                                                                                        <RectangleGeometry Rect="0,0,50,50"/>
                                                                                        <RectangleGeometry Rect="50,50,50,50"/>
                                                                                    </GeometryGroup>
                                                                                </GeometryDrawing.Geometry>
                                                                            </GeometryDrawing>
                                                                        </DrawingGroup>
                                                                    </DrawingBrush.Drawing>
                                                                </DrawingBrush>
                                                            </DiscreteObjectKeyFrame.Value>
                                                        </DiscreteObjectKeyFrame>
                                                    </ObjectAnimationUsingKeyFrames>
                                                </Storyboard>
                                            </BeginStoryboard>
                                        </EventTrigger>
                                        <EventTrigger RoutedEvent="UIElement.DragLeave">
                                            <BeginStoryboard>
                                                <Storyboard>
                                                    <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="BorderBrush">
                                                        <DiscreteObjectKeyFrame KeyTime="0:0:0">
                                                            <DiscreteObjectKeyFrame.Value>
                                                                <SolidColorBrush Color="Transparent"/>
                                                            </DiscreteObjectKeyFrame.Value>
                                                        </DiscreteObjectKeyFrame>
                                                    </ObjectAnimationUsingKeyFrames>
                                                </Storyboard>
                                            </BeginStoryboard>
                                        </EventTrigger>
                                        <EventTrigger RoutedEvent="UIElement.Drop">
                                            <BeginStoryboard>
                                                <Storyboard>
                                                    <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="BorderBrush">
                                                        <DiscreteObjectKeyFrame KeyTime="0:0:0">
                                                            <DiscreteObjectKeyFrame.Value>
                                                                <SolidColorBrush Color="Transparent"/>
                                                            </DiscreteObjectKeyFrame.Value>
                                                        </DiscreteObjectKeyFrame>
                                                    </ObjectAnimationUsingKeyFrames>
                                                </Storyboard>
                                            </BeginStoryboard>
                                        </EventTrigger>
                                    </Style.Triggers>
                                </Style>
                            </Border.Style>


                            <fa:IconImage Icon="FileImage"   x:Name="iconImageMy"
                                              Margin="10" 
                                              Style="{DynamicResource imageFon}"
                                    AllowDrop="True"/>



                        </Border>

                    </Border>

                    <Grid Margin="10 0 10 10" VerticalAlignment="Bottom">

                        <TextBlock Text="Путь сохранения картинок"
                                       Style="{DynamicResource textType}" Foreground="Black"
                                       Margin="19 0 0 30"/>
                        <TextBox Width="auto"  IsReadOnly="True"   x:Name="tbPath"
                                     Text=""
                                     FontSize="11"
                                     Height="18" Margin="21 20 60 0"/>
                        <Button Margin="0 18 10 0" 
                                            x:Name="btnPathFolders" 
                                            Style="{DynamicResource btnSelectPath}">
                            <fa:IconImage  Icon="FolderOpen"
                                    Style="{DynamicResource fa:IconImageTopButton}"/>

                            <Button.ToolTip>
                                <ToolTip Width="65">
                                    <TextBlock Text="Выбрать"/>
                                </ToolTip>
                            </Button.ToolTip>
                        </Button>
                    </Grid>

                </Grid>
            </Border>
            <Border  x:Name="borderRight" 
                                        Height="auto" Margin="30 110 0 90" 
                                        Style="{DynamicResource bodredMenyConvertImage}" Visibility="Visible">

                <Border Background="#FFEEB25F" Margin="30 20 30 70"  CornerRadius="20"
                                        AllowDrop="True" Width="700" HorizontalAlignment="Stretch">
                    <Border CornerRadius="20">
                        <Border.Background>
                            <ImageBrush ImageSource="/Pages/test.png" Stretch="Fill" />
                        </Border.Background>

                    </Border>
                </Border>

            </Border>
        </StackPanel>
    </Grid>
    <!--</Viewbox>-->
</Page>

Вот как сейчас это выглядит: Отображение по разметке

Хотелось бы, чтобы бордер уменьшался тогда, когда окно программы уменьшаем, и сама картинка тоже подстраивалась под размер внутреннего бордера.

Пробовал обернуть эту страницу в ViewBox, но масштабирование бордера получается неестественным.


Ответы (0 шт):