本文介绍了设计时间和图像路径相对。很烦人......的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一些非常烦人的事情,就是当我在设计时添加一个图像时,Expression Blend会获得一个副本并将图像放在Silverlight应用程序目录中。所以我经常在设计时添加静态图像,这样我在解决方案资源管理器中的这个目录中有大量的图像,这很糟糕。

有没有办法从ClientBin添加图像\Images\WHERE_ALL_MY_IMAGES_ARE并确保Expression Blend将图像放在那里。请勿将其带入silverlight目录。这样我就会保持我的silverlight目录干净并且图像在那里,因为我的应用程序在运行时去获取所有图像。


Gear

Hi,

There's something very anoying to me which is when I do add an image at design time that Expression Blend get a copy and place the image in the Silverlight application directory.  So Very often, I do add static images at design time and doing so I have tons of images in this directory in my Solution Explorer and this is awful.

Is there any way to add an image from ClientBin\Images\WHERE_ALL_MY_IMAGES_ARE and make sure Expression Blend will let the image there.  Don't bring it in the silverlight directory.  That way I will always keep my silverlight directory clean and the images are there because my application at runtime go get all the images there.


Gear

推荐答案

<BitmapImage x:Key="HomeButton" UriSource="Images\HomeButton.png" />



现在您可以将HomeButton称为资源,无论您需要它。当你决定你的HomeButton应该是蓝色而不是绿色时,这还有一个额外的好处,就是让你在整个应用程序中换出图像文件。所有人:我忘了提及,为此要正常工作,您需要在项目中包含HomeButton.png,否则您将在Blend中看到图形,但不会在运行时看到。


Now you can call HomeButton as a resource wherever you need it. This also has the added benefit of letting you swap out the image file across the app when you decide your HomeButton should be blue instead of green.


e: I forgot to mention, for this to work correctly you'll need to Include HomeButton.png in your project, otherwise you'll see the graphic in Blend but not at runtime.


这篇关于设计时间和图像路径相对。很烦人......的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-26 06:28