1

我想制作一个显示三个位图的控件,如下所示:

在此处输入图像描述

我的问题是我不想为位图固定“宽度”和“高度”。他们必须占据所有可用空间并保持其方面。

当我用 Blend 设计它时,设计师总是把固定尺寸....

这是我的代码:

<UserControl x:Class=""
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d"
FontFamily="{StaticResource PhoneFontFamilyNormal}"
FontSize="{StaticResource PhoneFontSizeNormal}"
Foreground="{StaticResource PhoneForegroundBrush}"
>

<Grid x:Name="LayoutRoot" Background="{StaticResource PhoneChromeBrush}">
    <Image HorizontalAlignment="Left" Height="203" Margin="53,30,0,0" VerticalAlignment="Top" Source="/FakeData/Images/lavieestbelle.jpg" RenderTransformOrigin="0.5,0.5" Width="144" UseLayoutRounding="False" d:LayoutRounding="Auto">
            <Image.RenderTransform>
                <CompositeTransform Rotation="-15"/>
            </Image.RenderTransform>
        </Image>
        <Image HorizontalAlignment="Left" Height="203" Margin="88,30,0,0" VerticalAlignment="Top" Source="/FakeData/Images/lavieestbelle.jpg" Width="144"/>
        <Image HorizontalAlignment="Left" Height="203" Margin="132.951,34.5,0,0" VerticalAlignment="Top" Source="/FakeData/Images/lavieestbelle.jpg" RenderTransformOrigin="0.5,0.5" UseLayoutRounding="False" d:LayoutRounding="Auto" Width="144">
            <Image.RenderTransform>
                <CompositeTransform Rotation="15"/>
            </Image.RenderTransform>
        </Image>
</Grid>

我怎样才能做到这一点 ?感谢您的帮助

4

1 回答 1

0

Image.Stretch属性可能会有所帮助http://msdn.microsoft.com/en-us/library/system.windows.controls.image.stretch.aspx

于 2013-06-07T21:54:53.200 回答