Search code examples
wpfvisual-studio-extensionsvsix

Image icons do not look well formed in Custom Visual Studio tool window (VSIX)


I'm working on a VSIX (Visual Studio Extension) project. It contains a tool window to display information.

Tool windows was created based on a walkthrough followed in MSDN.

I observed that Image icons (Png, jpg formats as per my tests) added to the Tool window are not look well formed (not in the original appearance), time to time when I change the size or positions of the tool window (by drag and drop, dock and undock).

Image Icon used : Cross.png

Modified Source code for FirstToolWindowControl.xaml (as per above walkthrough)

<UserControl x:Class="FirstToolWin.FirstToolWindowControl"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
             Background="{DynamicResource VsBrush.Window}"
             Foreground="{DynamicResource VsBrush.WindowText}"
             mc:Ignorable="d"
             d:DesignHeight="300" d:DesignWidth="300"
             Name="MyToolWindow">
    <Grid Width="auto" Height="auto">       
        <Image Margin="20" Source="C:\Cross.png" Width="16" Height="16" HorizontalAlignment="Center"  />
    </Grid>
</UserControl>

Malformed Image Screen capture: MalformedImageIcon.png

Appreciate anyone's assistance to find the root course and resolve the issue. Thank you.


Solution

  • Use XAML based Vector images instead of Raster image icons. We were able to find most of Standerd icons (XAML based) form this repository.