XAML图像 [英] XAML images
问题描述
我是新来的混合。这可能是一个基本问题。我有一个带有图像的插图文件。
I am new to blend. this might be a basic question. I have a illustrator file that has an image.
我将其导入设计并创建了一个XAML文件(资源 字典)并将其添加到项目中。
I imported it to design and created a XAML file(resource dictionary) and added it to the project.
现在,如何将按钮的背景设置为此图像(在XAML中)而不是.png(上一个)?
Now, How do I set the background of a button to this image(in XAML) instead of the .png(Previous)?
推荐答案
假设您已将设计生成的xaml文件添加到您的混合wpf项目中:选择您的按钮,在属性面板中找到background属性并单击其右侧的小矩形,选择local资源 - >设计创建的资源
的名称(在我的情况下,我刚试过的是Layer_1)
Assuming you have added the xaml file produced by design into your blend wpf project: select your button, in the properties panel find the background property and click the small rectangle to the right of it, select local resource -> the name of the resource created by design (in my case I just tried was Layer_1)
另一种方法是要选择按钮,选择背景画笔属性,选择其下方最右边的标签,然后选择合适的画笔。
An alternate way would be to select the button, select the background brush property, select the farthest right tab below it, and select the proper brush.
这篇关于XAML图像的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!