为什么这个Microsoft.VisualStudio.Imaging.CrispImage没有显示任何内容?

时间:2016-11-18 13:02:08

标签: wpf visual-studio-2015 vsix vsx vs-extensibility

我正在尝试创建一个非常简单的WPF应用程序来试验Visual Studio Image Service and Catalog的这个概念。

我不明白为什么我似乎无法在WPF设计器上或应用程序运行时显示任何已知图像(使用KnownMonikers)。

图像就在那里。它只是没有显示任何东西。

The image inside a border in the VS designer

enter image description here

这是WPF源代码(完全遵循上面MSDN链接中描述的步骤):

printf ("%p\n", h); // h is the address of "Hi", which is in the rodata or other segments of the application.
printf ("%p\n", &i); // I think "i" is not a global variable, so &i is in the stack of main. The stack address is by convention in the top area of the memory space of the process.

有人可以帮忙吗?

1 个答案:

答案 0 :(得分:0)

你的代码隐藏了什么来初始化ImageLibrary?如果图书馆找不到您要求的名字对象,那么它将不会显示图像。

确保在初始化ImageLibrary时,为其提供ImageCatalog的.imagemanifest文件的路径(在VS install目录中)。