2016-11-18 7 views
2

J'essaie de créer une application WPF très simple pour expérimenter ce concept de Visual Studio Image Service and Catalog.Pourquoi Microsoft.VisualStudio.Imaging.CrispImage n'affiche rien?

Je ne comprends pas pourquoi je n'arrive pas à montrer les images connues (en utilisant KnownMonikers) à la fois sur le concepteur WPF ou quand l'application fonctionne.

L'image est là. Ça ne montre rien.

The image inside a border in the VS designer

enter image description here

Voici le code source WPF (suivant exactement les étapes décrites dans le lien ci-dessus): MSDN

<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> 

aide Quelqu'un peut-il s'il vous plaît?

Répondre

0

Que fait votre code-behind pour initialiser ImageLibrary? Si la bibliothèque ne trouve pas le surnom que vous demandez, elle n'affiche pas l'image.

Assurez-vous que lors de l'initialisation d'ImageLibrary, vous lui donnez le chemin d'accès au fichier .imagemanifest d'ImageCatalog (dans le répertoire d'installation de VS).