2016-11-18 85 views
2

我想创建一个非常简单的WPF应用程序来实验这个Visual Studio Image Service and Catalog的概念。为什么这个Microsoft.VisualStudio.Imaging.CrispImage不显示任何内容?

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

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

The image inside a border in the VS designer

enter image description here

这里的(以下正是在MSDN链接上述步骤)的WPF源代码:

<Window x:Class="ImageCatalogBrowser.MainWindow" 
     xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" 
     xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" 
     xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
     xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
     xmlns:local="clr-namespace:ImageCatalogBrowser" 
     xmlns:imaging="clr-namespace:Microsoft.VisualStudio.Imaging;assembly=Microsoft.VisualStudio.Imaging" 
     xmlns:theming="clr-namespace:Microsoft.VisualStudio.PlatformUI;assembly=Microsoft.VisualStudio.Imaging" 
     xmlns:utilities="clr-namespace:Microsoft.VisualStudio.PlatformUI;assembly=Microsoft.VisualStudio.Utilities" 
     xmlns:catalog="clr-namespace:Microsoft.VisualStudio.Imaging;assembly=Microsoft.VisualStudio.ImageCatalog" 
     mc:Ignorable="d" 
     Title="MainWindow" Height="350" Width="525"> 
    <Window.Resources> 
     <utilities:BrushToColorConverter x:Key="BrushToColorConverter"/> 
    </Window.Resources> 
    <Grid> 
     <StackPanel 
      Background="White" 
      VerticalAlignment="Center" 
      theming:ImageThemingUtilities.ImageBackgroundColor="{Binding Background, RelativeSource={RelativeSource Self}, Converter={StaticResource BrushToColorConverter}}"> 
      <Border BorderThickness="1" BorderBrush="Black" Width="33" Height="33"> 
       <imaging:CrispImage 
        x:Name="crisp" 
        Visibility="Visible" 
        Width="32" 
        Height="32" 
        Moniker="{x:Static catalog:KnownMonikers.Save}" /> 
      </Border> 
     </StackPanel> 
    </Grid> 
</Window> 

谁能帮助吗?

回答

0

你在初始化ImageLibrary时做了什么代码隐藏?如果图书馆找不到您请求的名字,那么它将不会显示图片。

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

相关问题