设计视图中缺少图像 [英] missing images in design view
问题描述
您好,
我有自定义用户控件项目 - 带文字和图片的按钮。对于图像源我在代码后面有绑定和属性(注册DependencyProperty)。这大部分时间都工作正常,我只是在xaml属性中设置图像源(我使用相对路径
" /images/xy.png) 我遇到的问题是有时会构建混乱项目,而我在设计视图中看不到按钮上的图像。在运行模式下图像仍然是可见的。为了解决问题,我删除了bin / debug文件夹,重新设计了项目
中出现的项目和图像。这工作之前,但现在甚至我删除调试文件夹并进行重建,我仍然无法看到图像。不知道我该怎么办?
I have project with custom user control - button with text and image. For image source I have binding and property (registered DependencyProperty) in code behind. This worked ok most of time, I just set in xaml property for image source (I use relative path "/images/xy.png) The issue I have is that sometimes build messes project and I don't see images on buttons in design view. Images are still visibe in run mode. To solve issue I deleted bin/debug folder, rebuild project and images appered in design again. This worked before, but now even I delete debug folder and do a rebuild, I still cannot see images. Any idea what else should I do?
推荐答案
您好,
Hello,
我有自定义用户控件的项目 - 带文本和图像的按钮。对于图像源我在代码后面有绑定和属性(注册DependencyProperty)。这大部分时间都工作正常,我只是在xaml属性中设置图像源(我使用相对路径
" /images/xy.png) 我遇到的问题是有时会构建混乱项目,而我在设计视图中看不到按钮上的图像。在运行模式下图像仍然是可见的。为了解决问题,我删除了bin / debug文件夹,重新设计了项目
中出现的项目和图像。这工作之前,但现在甚至我删除调试文件夹并进行重建,我仍然无法看到图像。知道我还应该做什么吗?
I have project with custom user control - button with text and image. For image source I have binding and property (registered DependencyProperty) in code behind. This worked ok most of time, I just set in xaml property for image source (I use relative path "/images/xy.png) The issue I have is that sometimes build messes project and I don't see images on buttons in design view. Images are still visibe in run mode. To solve issue I deleted bin/debug folder, rebuild project and images appered in design again. This worked before, but now even I delete debug folder and do a rebuild, I still cannot see images. Any idea what else should I do?
嗨   jeefer,
你以前遇到过类似的问题吗?我根据你的话创建了一个样本,没有遇到任何问题。您的项目与其他版本的VS有同样的问题吗?我使用的是Visual Studio Enterprise 15.9.1版。
$
$
最好的问候
Yong Lu
Hi jeefer,
Have you ever had a similar problem doing before? I created a sample according to your words, and there was no issue you encountered. Did your project have the same problem with other versions of VS? I used Visual Studio Enterprise Version 15.9.1.
Best regards
Yong Lu
这篇关于设计视图中缺少图像的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!