Reputation: 1
I need to create an user control that displays the wafer map, so I used a ListBox with uniform grid and each cell represents a die in the wafer. The problem I got is that when there are too many dies, for example, 100*100 uniformgrid, will be super slow to display, and also the scroller view is slow. Below is my code:
<ListBox.ItemsPanel>
<ItemsPanelTemplate>
<UniformGrid VirtualizingPanel.VirtualizationMode="Recycling" VirtualizingPanel.IsVirtualizing="True" x:Name="WaferMapGrid" Columns="{Binding MapColumnCount}" VerticalAlignment="Stretch" HorizontalAlignment="Stretch" Rows="{Binding MapRowCount}" Background="AliceBlue" RenderTransformOrigin="0.5,0.5" Loaded="WaferMapGrid_Loaded">
<UniformGrid.LayoutTransform>
<ScaleTransform x:Name="WaferMapScaleForm" ScaleX="{Binding Path=Value, ElementName=ZoomSlider}" ScaleY="{Binding Path=Value, ElementName=ZoomSlider}" />
</UniformGrid.LayoutTransform>
</UniformGrid>
</ItemsPanelTemplate>
</ListBox.ItemsPanel>
<ListBox.Template>
<ControlTemplate TargetType="ListBox">
<ScrollViewer x:Name="WaferMapScrollViewer" CanContentScroll="True" VirtualizingPanel.IsVirtualizing="True" VirtualizingPanel.VirtualizationMode="Recycling" Loaded="WaferMapScrollViewer_Loaded" ScrollChanged="OnScrollViewerScrollChanged" PreviewMouseDown="OnMouseLeftButtonDown" PreviewMouseWheel="WaferMapScrollViewer_PreviewMouseWheel" PreviewMouseMove="OnMouseMove" PreviewMouseUp="OnMouseLeftButtonUp" HorizontalScrollBarVisibility="Visible" VerticalScrollBarVisibility="Visible" Padding="0">
<ScrollViewer.Resources>
<Style TargetType="ScrollBar">
<Style.Triggers>
<Trigger Property="Orientation" Value="Vertical">
<Setter Property="Width" Value="4"/>
<Setter Property="Margin" Value="0,0,0,0"/>
</Trigger>
</Style.Triggers>
</Style>
</ScrollViewer.Resources>
<ItemsPresenter></ItemsPresenter>
</ScrollViewer>
</ControlTemplate>
</ListBox.Template>
<ListBox.ItemTemplate>
<DataTemplate>
<Grid>
<RadioButton x:Name="Die" MinHeight="{Binding ActualWidth,RelativeSource={RelativeSource Self}}" MinWidth="{Binding ActualHeight,RelativeSource={RelativeSource Self}}" Background="{Binding TestState,Converter={StaticResource TestStateConverter}}" BorderBrush="LightGray" BorderThickness="0.5" IsChecked="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type ListBoxItem}}, Path=IsSelected}" GroupName="DieGroup" Style="{StaticResource DieStyle}" Margin="0" Content="{Binding DisplayText}" >
<RadioButton.ToolTip>
<local:DieInfo></local:DieInfo>
</RadioButton.ToolTip>
</RadioButton>
</Grid>
</DataTemplate>
</ListBox.ItemTemplate>
</ListBox>
By the way, the Virtualization seems not working in uniformgird. Any one knows how to optimize my code to improve the proformance? Attach the screen shot of my application:
Upvotes: 0
Views: 137