ImageControl不显示在执行中 [英] ImageControl dont show in execution

查看:153
本文介绍了ImageControl不显示在执行中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在XAML中使用此代码:

I use this code in XAML:

<Image x:Name="img2" HorizontalAlignment="Left"
       Width="128" Height="128" Canvas.Left="343" 
       Canvas.Top="192" 
       Source="pack://siteoforigin:,,,/Resources/Trophy-Gold-icon11.png"/>

我使用visual studio 2012.在运行之前,图像控件显示已分配的图像(在设计器窗口中)但在执行时间,图像控件不显示图像。

I use visual studio 2012. Before running, image control shows assigned image (in designer window) but at execution time, the image is not displayed by image control.

推荐答案

确保图像构建动作设置为资源。 (右键单击图像,然后转到属性,将构建操作设置为资源)

Make sure image build action is set to Resource. (right click on an image and then go to properties, set build action to resource)

此外,而不是 siteoforigin 使用应用程序权限 -

Also, instead of siteoforigin use application authority -

Source="pack://application:,,,/Resources/Trophy-Gold-icon11.png"

这篇关于ImageControl不显示在执行中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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