XAML图形矢量作为图像源 [英] XAML graphic vector as image source

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

问题描述

现在许多图形设计人员将图像作为xaml文件提供,而不是ico,png,...,我如何使用xaml文件作为图像源?

Now many graphics designers provide the images as xaml file not ico, png, ..., How can I use a xaml file as image source?

谢谢

推荐答案

我通常使用几何图形来提供图标"路径.而不是图像.

I generally use geometries to provide the paths for "icons" rather than images.

您可以使用以下免费应用获取此类路径: https://www.syncfusion.com/downloads/metrostudio

You can get such paths using this free app: https://www.syncfusion.com/downloads/metrostudio

它提供了一个库.

您可以在其中看到使用的方法:

You can see the approach in use in this:

http://social.technet .microsoft.com/wiki/contents/articles/32610.wpf-layout-lab.aspx?Sort = MostRecent& PageIndex = 1

例如

            <Button  Command="{Binding ShowLayout2}"
                     Background="{StaticResource ResourceKey=LightBrightGradientBrush}">
                <Grid>
                    <Path Data="{StaticResource eMailIcon}"
                          Stretch="Uniform" Fill="{StaticResource MidDullBrush}" Width="20" Height="20" RenderTransformOrigin="0.5,0.5">
                    </Path>
                </Grid>
            </Button>

,并在我的资源字典中,该字典由app.xaml合并:

and in my resource dictionary, which is merged by app.xaml:

<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
                    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
                      >
    <Geometry x:Key="eMailIcon">
        M0,8.5909986L28.326799,29.197784C32.25,32.373585,35.237099,29.385284,35.237099,29.385284L64,8.5909986 64,47.064999 0,47.064999z M0,0L63.875,0 63.875,3.7343616 32.872349,26.146971C32.872349,26.146971,31.87495,27.018066,31.127552,26.271971L0,3.4856424z
    </Geometry>

该示例应用程序是该文章的链接.

The sample application is linked from that article.


这篇关于XAML图形矢量作为图像源的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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