如何使两个图像与WPF重叠? [英] How to make two images overlapping with WPF?
问题描述
我有以下的XAML code,它显示的图片的(图像内部边框)和一个标志。眼下,标志出现在画面下方。这是预期的,但是我的目标是有标志的图片(precisely在右下角)的顶部。 是否有人有一个想法如何做到这一点?我们有层在WPF?
注:我绝对需要保持WrapPanel中
< WrapPanel中>
< BORDER BorderBrush =灰了borderThickness =1保证金=3>
< BORDER BorderBrush =白了borderThickness =3>
< BORDER BorderBrush =浅灰色了borderThickness =0.5>
<图像源=http://farm1.static.flickr.com/2/1703693_687c42c89f_s.jpg拉伸=制服/>
< /边框>
< /边框>
< /边框>
<图像源=http://l.yimg.com/g/images/flickr_logo_gamma.gif.v59899.14高度=10/>
< / WrapPanel中>
您应该可以做线沿线的东西:
< WrapPanel中>
<电网>
< BORDER BorderBrush =灰了borderThickness =1保证金=3>
< BORDER BorderBrush =白了borderThickness =3>
< BORDER BorderBrush =浅灰色了borderThickness =0.5>
<图像源=http://farm1.static.flickr.com/2/1703693_687c42c89f_s.jpg拉伸=制服/>
< /边框>
< /边框>
< /边框>
<图像保证金=5的HorizontalAlignment =右VerticalAlignment =底来源=http://l.yimg.com/g/images/flickr_logo_gamma.gif.v59899.14高度=10/&GT ;
< /网格>
< / WrapPanel中>
通过不指定我们的网格放置2项在0行0列和堆叠它们在彼此的顶部任何行或列。第二图像具有水平和垂直对齐设置,使其出现在右下角,而我添加了一个缘至第2图像撞了位,否则就坐在我假设的边界是不是你想要的?
I have the following XAML code, which displays a picture (image inside borders) and a logo. Right now, the logo appears below the picture. This is expected, however my goal is to have the logo on top of the picture (precisely at the bottom-right corner). Does someone has an idea how to do that? Do we have layers in WPF?
Note: I absolutely need to keep the WrapPanel.
<WrapPanel>
<Border BorderBrush="Gray" BorderThickness="1" Margin="3">
<Border BorderBrush="White" BorderThickness="3">
<Border BorderBrush="LightGray" BorderThickness="0.5">
<Image Source="http://farm1.static.flickr.com/2/1703693_687c42c89f_s.jpg" Stretch="Uniform" />
</Border>
</Border>
</Border>
<Image Source="http://l.yimg.com/g/images/flickr_logo_gamma.gif.v59899.14" Height="10" />
</WrapPanel>
You should be able to do something along the lines of:
<WrapPanel>
<Grid>
<Border BorderBrush="Gray" BorderThickness="1" Margin="3">
<Border BorderBrush="White" BorderThickness="3">
<Border BorderBrush="LightGray" BorderThickness="0.5">
<Image Source="http://farm1.static.flickr.com/2/1703693_687c42c89f_s.jpg" Stretch="Uniform" />
</Border>
</Border>
</Border>
<Image Margin="5" HorizontalAlignment="Right" VerticalAlignment="Bottom" Source="http://l.yimg.com/g/images/flickr_logo_gamma.gif.v59899.14" Height="10" />
</Grid>
</WrapPanel>
By not specifying any rows or columns our grid places the 2 items in row 0 column 0 and stacks them on top of each other. The second image has Horizontal and Vertical alignment set to make it appear in the bottom right, and I've added a margin to the 2nd image to bump it up a bit, otherwise it sits on the border which I assume is not what you wanted?
这篇关于如何使两个图像与WPF重叠?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!