Hello,
I have a UserControl that contains a TreeView defined like:
<TreeView Name="treeViewGroupings" Grid.Row="2" Grid.Column="0" Width="335" Height="400"
ItemsSource="{Binding TreeViewItems}" Margin="0,3,0,0">
<TreeView.Resources>
<HierarchicalDataTemplate DataType="{x:Type Models:RGFolderItem}" ItemsSource="{Binding
Path=Items}">
<StackPanel Orientation="Horizontal">
<Image Source="{Binding Path=Image}"
/>
<TextBlock Text="{Binding Path=Name}"
/>
</StackPanel>
</HierarchicalDataTemplate>
<DataTemplate DataType="{x:Type Models:RGFileItem}">
<StackPanel Orientation="Horizontal">
<Image Source="{Binding Path=Image}"/>
<TextBlock Text="{Binding Path=Name}"/>
</StackPanel>
</DataTemplate>
</TreeView.Resources>
</TreeView>
The image path is retrieved via binding and there is no issue with displaying the image. The issue is when this control is added to the center part of the main window's dockpanel. The icons displayed in the treeview are a bit blurry. I tried to manually set the height and width or the image but that did not help. If I load the usercontrol in a WPF popup window, however, the images look just fine. It seems that something in the main application's defined styles (or something else) is impacting the images, but I don't know what it could be since we have only a few global styles and nothing related to images per se. This is an odd issue but thought I would throw this out there in case someone has run across this in the past.
Thanks for any thoughts - Peter