窗口的图标来自资源字典 [英] Window’s Icon from as Resource Dictionary

查看:75
本文介绍了窗口的图标来自资源字典的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

此形式中的多个主题说服我在图像字典"中仅将图像称为静态资源".我已经知道如何对菜单项和按钮执行此操作,但对于Windows则不行.我可以通过Window的Icon属性为图标指定一个png文件,但无法确定如何创建所需的资源.它不喜欢Image或BitmapImage. Icon类需要构造函数上的文件名,所以我认为我不能在Xaml中使用它. 是否有一种方法可以在Xaml中创建Window会喜欢的资源?

解决方案

大卫,您好,

我认为您正在寻找的是ImageSource.看一下此链接 http://cs. axvius.com/blogs/parker/archive/2007/10/05/wpf-icon-as-imagesource.aspx .

最好的问候


Several topics in this form as convinced me to only refer to images as Static Resource in a Image Dictionary. I’ve figure out how to do this for menu items and buttons but not for windows. The Window’s Icon property lets me specify a png file for my icon but I can’t figure out how to create a resource that it will like. It doesn’t like an Image or a BitmapImage. The Icon class wants the file name on the constructor so I don’t think I can use it in Xaml.  

Is there a way to create a resource in Xaml that a Window will like?

解决方案

Hi David,

I think what you're looking for is an ImageSource. Take a look at this link http://cs.axvius.com/blogs/parker/archive/2007/10/05/wpf-icon-as-imagesource.aspx.

Best Regards


这篇关于窗口的图标来自资源字典的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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