I'm creating a dialog with a single image, and a polygon overlaid. The problem is that the scale of the image is different from that of the polygon, so I want to scale the image down to match the scale of the polygon. But when I use the RenderTransform/ScaleTransform tags, the image gets sized down leaving whitespace at the right and bottom of the dialog. Yes the overlay now works properly, but I'd like to have it fill the available space to fill the window.

<Window x:Class="vw.CollImage"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    Title="Collection Image" Height="700" Width="700"
    WindowStartupLocation="CenterOwner" Grid.IsSharedSizeScope="False"
    Icon="Resources\ty.ico">

    <Viewbox MinWidth="70" MinHeight="70">
        <Grid>
            <Image Name="imgColl" HorizontalAlignment="Left" VerticalAlignment="Top" Source="{Binding ImageData}">
                <Image.RenderTransform>
                    <ScaleTransform ScaleX="0.75" ScaleY="0.75"/>
                </Image.RenderTransform>
            </Image>
            <Polyline Stroke="OrangeRed" StrokeThickness="6" Points="{Binding Coordinates}"/>
        </Grid>
    </Viewbox>
</Window>
有帮助吗?

解决方案

Apply it as LayoutTransform instead.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top