创建圆形图像 Xaml [英] Create Circular Image Xaml

查看:27
本文介绍了创建圆形图像 Xaml的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在 Windows Phone 8 中,我想将图像放在一个圆圈中.是否有类似网格的圆形容器?我知道有椭圆位它不是容器

In windows phone 8 I want to put an Image in a circle. Is there a container like grid which have a circular form? I know that there is ellipse bit it is not a container

推荐答案

这是我的做法.

<Ellipse Width="100"
         Height="100">
    <Ellipse.Fill>
        <ImageBrush>
            <ImageBrush.ImageSource>
                <BitmapImage UriSource="/YourImage.png" />
            </ImageBrush.ImageSource>
        </ImageBrush>
    </Ellipse.Fill>
</Ellipse>

作为最佳实践,请考虑将 DecodePixelWidthDecodePixelHeight 设置为与椭圆相同的大小.

As a best practice, consider setting DecodePixelWidth and DecodePixelHeight to the same size as your ellipse.

这篇关于创建圆形图像 Xaml的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆