An odd problem appears to be happening to icons placed within my TabControl
tabs. When a single tab is constructed, the icon appears correct.
When another tab is added, or the tab is selected, the icon(s) seem to offset upwards by one pixel, and duplicate the bottom row.
My ItemTemplate
looks similar to the following slimmed-down version:
<TabControl.ItemTemplate>
<DataTemplate>
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*"></ColumnDefinition>
<ColumnDefinition Width="Auto"></ColumnDefinition>
</Grid.ColumnDefinitions>
<StackPanel Grid.Column="0" Orientation="Horizontal">
<Image Source="{Binding Tab.IconFilename}" Width="16" Height="16" Stretch="None" />
<TextBlock Text="{Binding Tab.DisplayHeader}" />
</StackPanel>
<Button Grid.Column="1" Name="ButTabClose" Width="16" Height="16" Click="ButTabClose_Click">
<Image Source="{StaticResource CloseCross}" Stretch="None" />
</Button>
</Grid>
</DataTemplate>
</TabControl.ItemTemplate>
Images are styled application-wide with the following:
<Style TargetType="Image">
<Setter Property="SnapsToDevicePixels" Value="True"/>
<Setter Property="UseLayoutRounding" Value="True"/>
<Setter Property="RenderOptions.BitmapScalingMode" Value="NearestNeighbor"/>
<Setter Property="RenderOptions.EdgeMode" Value="Aliased"/>
</Style>
Removing the BitmapScalingMode
shows the whole image, but it is blurred.