![](/img/trans.png)
[英]Border Control in Windows Phone 7, Auto Height & Width not right
[英]How to replace fixed width and height on a custom windows phone control?
我想制作一个显示三个位图的控件,如下所示:
我的问题是我不想为位图设置固定的“宽度”和“高度”。 他们必须占据所有可用空间并保持其外观。
当我使用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>
我怎样才能做到这一点 ? 感谢您的帮助
Image.Stretch
属性对http://msdn.microsoft.com/zh-cn/library/system.windows.controls.image.stretch.aspx很有帮助。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.