문제

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