VirtualizingWrapPanel usage question
arc95 opened this issue · comments
I'm using the VirtualizingWrapPanel
and just get a flickering box. Here's my XAML:
<DataTemplate x:Key="ImageTemplate">
<StackPanel Orientation="Vertical" Margin="12">
<Image Width="195" Stretch="Fill" Source="{Binding Url}" ToolTipService.ShowDuration="9000000">
<Image.ToolTip>
<ToolTip DataContext="{Binding PlacementTarget,
RelativeSource={RelativeSource Self}}" HasDropShadow="True">
<Border BorderBrush="Black" BorderThickness="0" Margin="5,7,5,5">
<Image Source="{Binding Source}" Width="595" Stretch="Uniform" />
</Border>
</ToolTip>
</Image.ToolTip>
</Image>
<TextBox FontWeight="Bold" Text="{Binding Filename, Mode=OneWay}" IsReadOnly="True" Margin="0 3 0 0"
Style="{StaticResource FieldTextBox}" Width="195" HorizontalContentAlignment="Center" />
</StackPanel>
</DataTemplate>
<ListView ItemsSource="{Binding Images, UpdateSourceTrigger=PropertyChanged}"
VirtualizingStackPanel.IsVirtualizing="True"
VirtualizingStackPanel.VirtualizationMode="Recycling"
ScrollViewer.HorizontalScrollBarVisibility="Disabled"
ItemTemplate="{StaticResource ImageTemplate}" Margin="25 0 25 25">
<ListView.ItemsPanel>
<ItemsPanelTemplate>
<wpfControls:VirtualizingWrapPanel IsItemsHost="True" />
</ItemsPanelTemplate>
</ListView.ItemsPanel>
</ListView>
Got it! Needed to add height/width on the child container and remove VirtualizingStackPanel.IsVirtualizing="True" VirtualizingStackPanel.VirtualizationMode="Recycling"
.
Excellent! Glad you figured it out.
after connecting this panel, the sizes of items are all square and the sizes are not changed. I understand I need to manually register. Well, when a lot of elements, when scrolling the mouse wheel, top and bottom flash empty lines, fail to load.