在ResourceDictionary中设置图标 [英] Set icon in ResourceDictionary

查看:89
本文介绍了在ResourceDictionary中设置图标的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我的ResourceDictionary中我有这样的陈述:



In my ResourceDictionary I have this statement:

<Style TargetType="MenuItem">
    <Style.Triggers>
        <Trigger Property="Header" Value="Close">
            <Setter Property="Icon" Value="WHAT TO PUT HERE???"/>
        </Trigger>
    </Style.Triggers>
</Style>







如何设置图标?

我的图标都在一个文件夹中。




How can I set the icon?
My icons are all in a folder.

推荐答案

您好,



您必须将图像的位置相对于项目中的文件位置



1添加您的图片

2将图像uri写为文件夹/文件



例如。假设您有一个图像test.jpg。



将它添加到资源文件夹中的项目中,在主文件夹中,有ResourceDictionary。所以,在你的标记行中,写上Resources / test.jpg。



如果找不到任何相对位置,因为你的字典分别位于不同的文件夹中图片,使用uri包语法



pack:// application:,,, / Resources / test.jpg



希望这有帮助。



LG
Hi,

You have to put the position of your image relative to your file location in the project

1 Add your image
2 Write the image uri as Folder/file

For example. Let's say you have an image test.jpg.

Add it to your project in the folder Resources and, in the main folder, there is your ResourceDictionary. So, in your marked line, write "Resources/test.jpg".

If you cannot find any relative position because your dictionary is in a different folder respectively to your image, use the uri pack syntax

pack://application:,,,/Resources/test.jpg

Hope this helped.

LG


这篇关于在ResourceDictionary中设置图标的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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