WrapPanel in VirtualizingStackPanel doesn't repaint properly on resize
<p>I have a ItemsControl that have virtualization. As DataTemplate I have a WrapPanel. The problem is when I resize the container the wrap panel doesn't repaint properly. It crates new rows to wrap the text but the text remains on the top row.</p>

<p>I have created a simple test project to show the problem.
Here is the XAML: (MainWindow.xaml)</p>

<pre><code>&lt;Window x:Class="WpfApplication1.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:WpfApplication1"
        mc:Ignorable="d"
        Title="MainWindow"
        Height="350"
        Width="525"&gt;
    &lt;Window.Resources&gt;
        &lt;Style x:Key="ItemsControlStyle"
               TargetType="ItemsControl"&gt;
            &lt;Setter Property="Background"
                    Value="White" /&gt;
            &lt;Setter Property="ScrollViewer.CanContentScroll"
                    Value="True" /&gt;
            &lt;Setter Property="VirtualizingPanel.IsVirtualizing"
                    Value="True" /&gt;
            &lt;Setter Property="ItemsPanel"&gt;
                &lt;Setter.Value&gt;
                    &lt;ItemsPanelTemplate&gt;
                        &lt;VirtualizingStackPanel IsItemsHost="True" /&gt;
                    &lt;/ItemsPanelTemplate&gt;
                &lt;/Setter.Value&gt;
            &lt;/Setter&gt;
            &lt;Setter Property="Template"&gt;
                &lt;Setter.Value&gt;
                    &lt;ControlTemplate TargetType="ItemsControl"&gt;
                        &lt;ScrollViewer BorderThickness="0"
                                      CanContentScroll="True"
                                      Padding="{TemplateBinding Control.Padding}"
                                      Background="{TemplateBinding Panel.Background}"
                                      HorizontalScrollBarVisibility="{TemplateBinding ScrollViewer.HorizontalScrollBarVisibility}"
                                      VerticalScrollBarVisibility="{TemplateBinding ScrollViewer.VerticalScrollBarVisibility}"
                                      Focusable="False"&gt;
                            &lt;ItemsPresenter /&gt;
                        &lt;/ScrollViewer&gt;
                    &lt;/ControlTemplate&gt;
                &lt;/Setter.Value&gt;
            &lt;/Setter&gt;
        &lt;/Style&gt;
    &lt;/Window.Resources&gt;
    &lt;ItemsControl Name="Items"
                  Grid.Row="1"
                  AlternationCount="2"
                  Style="{StaticResource ItemsControlStyle}"
                  ScrollViewer.HorizontalScrollBarVisibility="Disabled"
                  ScrollViewer.VerticalScrollBarVisibility="Auto"&gt;
        &lt;ItemsControl.ItemTemplate&gt;
            &lt;DataTemplate&gt;
                &lt;WrapPanel&gt;
                    &lt;TextBlock Text="Wrap Item" /&gt;
                    &lt;TextBlock Text="Wrap Item" /&gt;
                    &lt;TextBlock Text="Wrap Item" /&gt;
                    &lt;TextBlock Text="Wrap Item" /&gt;
                    &lt;TextBlock Text="Wrap Item" /&gt;
                    &lt;TextBlock Text="Wrap Item" /&gt;
                    &lt;TextBlock Text="Wrap Item" /&gt;
                    &lt;TextBlock Text="Wrap Item" /&gt;
                    &lt;TextBlock Text="Wrap Item" /&gt;
                    &lt;TextBlock Text="Wrap Item" /&gt;
                    &lt;TextBlock Text="Wrap Item" /&gt;
                    &lt;TextBlock Text="Wrap Item" /&gt;
                    &lt;TextBlock Text="Wrap Item" /&gt;
                    &lt;TextBlock Text="Wrap Item" /&gt;
                    &lt;TextBlock Text="Wrap Item" /&gt;
                    &lt;TextBlock Text="Wrap Item" /&gt;
                    &lt;TextBlock Text="Wrap Item" /&gt;
                    &lt;TextBlock Text="Wrap Item" /&gt;
                    &lt;TextBlock Text="Wrap Item" /&gt;
                    &lt;TextBlock Text="Wrap Item" /&gt;
                    &lt;TextBlock Text="Wrap Item" /&gt;
                    &lt;TextBlock Text="Wrap Item" /&gt;
                    &lt;TextBlock Text="Wrap Item" /&gt;
                    &lt;TextBlock Text="Wrap Item" /&gt;
                    &lt;TextBlock Text="Wrap Item" /&gt;
                    &lt;TextBlock Text="Wrap Item" /&gt;
                    &lt;TextBlock Text="Wrap Item" /&gt;
                    &lt;TextBlock Text="Wrap Item" /&gt;
                    &lt;TextBlock Text="Wrap Item" /&gt;
                &lt;/WrapPanel&gt;
            &lt;/DataTemplate&gt;
        &lt;/ItemsControl.ItemTemplate&gt;
    &lt;/ItemsControl&gt;
&lt;/Window&gt;
</code></pre>

<p>And here is the Code: (MainWindow.xaml.cs)</p>

<pre><code>using System.Linq;
using System.Windows;

namespace WpfApplication1
{
    public partial class MainWindow : Window
    {
        public MainWindow()
        {
            InitializeComponent();

            this.Items.ItemsSource = Enumerable.Range( 0, 30 );
        }
    }
}
</code></pre>