WP7 / WPF Stretch =“Uniform”时图像周围的空白区域

时间:2012-05-16 20:07:23

标签: wpf silverlight image windows-phone-7

我正在使用Windows Phone 7应用程序,它在HyperlinkBut​​ton中加载图像。这很有效,除了Stretch="Uniform"导致在图像不完全正方形时围绕图像放置白色空间。有没有办法让这个透明?

White space around image

<HyperlinkButton NavigateUri="{Binding Id, StringFormat='{}/x;component/Pages/FullScreenImage.xaml?id={0}'}"
                    Grid.Column="0" Grid.Row="0"
                    toolkit:TiltEffect.IsTiltEnabled="True" Background="Transparent">
    <HyperlinkButton.Template>
        <ControlTemplate TargetType="HyperlinkButton">
            <Grid Margin="0,0,0,10" >
                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="*" />
                </Grid.ColumnDefinitions>
                <Grid.RowDefinitions>
                    <RowDefinition Height="Auto" />
                    <RowDefinition Height="*" />
                </Grid.RowDefinitions>

                <TextBlock Grid.Column="0"
                    Grid.Row="0"
                    Text="Advertised"
                    Margin="10,0,0,0"
                    Style="{StaticResource PhoneTextSubtleStyle}" />
                <Image Grid.Column="0"
                    Grid.Row="1"
                    Margin="0"
                    Stretch="Uniform" 
                    Source="{Binding ExpectedImage}"  />
            </Grid>
        </ControlTemplate>
    </HyperlinkButton.Template>
</HyperlinkButton>

1 个答案:

答案 0 :(得分:0)

我的图片来源正在创建白色。 : - /