I'm working on custom control which uses VirtualizingStackPanel with mode set to "recycling" and I run into following problem: https://i.stack.imgur.com/76oSZ.png
It happens when I "play" with columns width for a while and then maximize the window. I don't know what causes this. PrepareContainerForItemOverride is called, I checked cells width and it is correct, it seems that StackPanel which holds cells just isn't rearranging its contents and I don't know how to force it to do so...
I know I'm not giving too much detail but maybe some of you had similar problem and just happen to know the solution.
EDIT: XAML for relevant part:
<Style x:Key="{x:Type dgp:CellsPresenter}" TargetType="{x:Type dgp:CellsPresenter}">
<Setter Property="ItemsPanel">
<Setter.Value>
<ItemsPanelTemplate>
<StackPanel Orientation="Horizontal"/>
</ItemsPanelTemplate>
</Setter.Value>
</Setter>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type dgp:CellsPresenter}">
<ItemsPresenter/>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<Style x:Key="{x:Type dg:Cell}" TargetType="{x:Type dg:Cell}">
<Setter Property="Background" Value="{DynamicResource {x:Static SystemColors.ControlLightLightBrushKey}}" />
<Setter Property="BorderBrush" Value="{DynamicResource {x:Static SystemColors.ControlDarkBrushKey}}" />
<Setter Property="BorderThickness" Value="0,0,1,1" />
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type dg:Cell}">
<Border Background="{TemplateBinding Background}"
BorderBrush="{TemplateBinding BorderBrush}"
BorderThickness="{TemplateBinding BorderThickness}"
SnapsToDevicePixels="True">
<ContentPresenter SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"
HorizontalAlignment="Center"
VerticalAlignment="Center"/>
</Border>
</ControlTemplate>
</Setter.Value>
</Setter>
<Style.Triggers>
<Trigger Property="IsSelected" Value="True">
<Setter Property="Background" Value="{DynamicResource {x:Static SystemColors.HighlightBrushKey}}" />
<Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.HighlightTextBrushKey}}" />
</Trigger>
</Style.Triggers>
</Style>
Each row (simple control, XAML irrelevant) holds CellPresenter and rows are stacked into VirtualizingStackPanel. It seems that StackPanel with horizontal orientation that you can see in ItemsPanelTemplate is not updating its layout.