I have the following WPF application
<Window x:Class="Window1"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="clr-namespace:WpfApplication1"
Title="Window1" Height="300" Width="300">
<Grid>
<TabControl>
<TabItem Header="Test1">
<local:ImageView />
</TabItem>
<TabItem Header="Test2">
<local:ImageView />
</TabItem>
<TabItem Header="Test3">
<local:ImageView />
</TabItem>
</TabControl>
</Grid>
</Window>
ImageView is a UserControl defined as
<UserControl x:Class="ImageView"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" >
<Grid>
<Image Source="pack://application:,,,/Resources/icon.png" Width="15" Height="15" />
</Grid>
</UserControl>
When I switch between TabItems, sometimes the image displays, sometimes it doesn't. Why does this happen?