类库中usercontrol中的资源图像未显示在主应用程序WPF中 [英] Resource image in usercontrol in class library not displaying in the main application WPF
问题描述
我有一个带有用户控件的类库项目。我已将图像文件夹添加到类库中,并在同一项目中使用用户控件中的图像。现在在主wpf项目中添加用户控件。但图像没有显示。 I
创建了一个具有相同流程的示例应用程序。
I have a class library project with user controls. I have added the image folder to the class library and using the image in the user control in the same project. and now adding the user control in the main wpf project. but the image is not displaying. I created a sample application with same flow there it is working.
Source =" pack:// application:,,, / Images / FolderImages / down.png"
Source="pack://application:,,,/Images/FolderImages/down.png"
但是如何设置dll构建动作。我正在添加库项目作为我的主要wpf项目的参考。
But how to set dll build action. i am adding the library project as reference to my main wpf project.
推荐答案
使用以下格式解决。
Got solved by using the below format.
Source =" / CustomControls; Component / Images / FolderImages / down.png"
Source="/CustomControls;Component/Images/FolderImages/down.png"
这篇关于类库中usercontrol中的资源图像未显示在主应用程序WPF中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!