title: Binding 1000usercontrols to listbox is slow wpf
body: <p>I am having a listbox to which i am binding around 1000usercontrols with itemspaneltemplate as grid and i am placing each usercontrol by specifying rows and columns which is working fine.
  But problem is it takes too much of time to load i even used backgroundworker process also but also no use.
  Please help me what is the solution for the above problem.</p>
  
  <pre><code>
  &lt;ListBox VerticalAlignment="Top" ItemsSource="{Binding Session.LstPlannedLightChkEntity,ElementName=uc, IsAsync=True}"  Grid.Row="0" 
                                 VirtualizingStackPanel.IsVirtualizing="True" VirtualizingStackPanel.VirtualizationMode="Recycling"
                                local:DragDropHelper.IsDragSource="true" local:DragDropHelper.IsDropTarget="true" 
                                local:DragDropHelper.DragDropTemplate="{StaticResource planetTemplateDrag}"  
                                ScrollViewer.VerticalScrollBarVisibility="Hidden" ScrollViewer.HorizontalScrollBarVisibility="Disabled" 
                                ScrollViewer.CanContentScroll="True"  
                              >
    &lt;ListBox.ItemContainerStyle>
      &lt;Style TargetType="ListBoxItem">
        &lt;Setter Property="Grid.Row" Value="{Binding Row}"/>
        &lt;Setter Property="Grid.Column" Value="{Binding Column}"/>
        &lt;Setter Property="Grid.ColumnSpan" Value="{Binding ColumnSpan}" />
      &lt;Style.Resources>
      &lt;!-- Background of selected item when focussed -->
      &lt;SolidColorBrush x:Key="{x:Static SystemColors.HighlightBrushKey}" Color="Transparent"/>
      &lt;!-- Background of selected item when not focussed -->
      &lt;SolidColorBrush x:Key="{x:Static SystemColors.ControlBrushKey}" Color="Transparent" />
        &lt;/Style.Resources>
      &lt;/Style>
    &lt;/ListBox.ItemContainerStyle>
    &lt;ListBox.ItemsPanel>
      &lt;ItemsPanelTemplate>
        &lt;local:GridControl x:Name="gcMenuPlanned" VerticalAlignment="Stretch"  Margin="-1,-1,0,0"
           ShowCustomGridLines="True" GridLineBrush="#FFE4E7EB" GridLineThickness="0.5" SnapsToDevicePixels="True">
          &lt;local:GridControl.ContextMenu>
          &lt;ContextMenu >
            &lt;MenuItem Foreground="Black"  Header="Add Task" Click="AddTask_Click" Tag="{Binding CheckType}"  />
            &lt;MenuItem Foreground="Black"  Header="Goto..."  Click="miGoto_Click" Tag="{Binding CheckType}"  />
          &lt;/ContextMenu>
        &lt;/local:GridControl.ContextMenu>
      &lt;/local:GridControl>
    &lt;/ItemsPanelTemplate>
  &lt;/ListBox.ItemsPanel>
  &lt;ListBox.ItemTemplate>
    &lt;DataTemplate>
      &lt;local:LightFCCheckBlockControl  CheckColor="#FFA2CAEB" MouseLeftButtonDown="LightFCCheckBlockControl_MouseLeftButtonDown">
        &lt;local:LightFCCheckBlockControl.ContextMenu>
          &lt;ContextMenu >
            &lt;MenuItem Foreground="Black"  Header="Edit" Click="miEdit_Click" Tag="{Binding CheckType}" Visibility="{Binding Path=OpacityForCCheck,Converter={StaticResource opacityToVisibility}}"/>
            &lt;MenuItem Foreground="Black" Style="{StaticResource MenuItemBindingStyle }"  Click="miFreeze_Click" Tag="{Binding CheckType}" Visibility="{Binding Path=OpacityForCCheck,Converter={StaticResource opacityToVisibility}}">
            &lt;/MenuItem>
            &lt;MenuItem Foreground="Black" Click="RemoveChecks_Click"  Header="Remove Checks" Tag="{Binding CheckType}"/>
            &lt;MenuItem Foreground="Black" Click="DeleteChecks_Click"  Header="Delete Checks" Tag="{Binding CheckType}" Visibility="{Binding Path=OpacityForCCheck,Converter={StaticResource opacityToVisibility}}"/>
            &lt;MenuItem Foreground="Black"  Header="Goto..."  Click="miGoto_Click" Tag="{Binding CheckType}" Visibility="{Binding Path=OpacityForCCheck,Converter={StaticResource opacityToVisibility}}"/>
          &lt;/ContextMenu>
        &lt;/local:LightFCCheckBlockControl.ContextMenu>
      &lt;/local:LightFCCheckBlockControl>
    &lt;/DataTemplate>
  &lt;/ListBox.ItemTemplate>
  &lt;/ListBox>
  </code></pre>
  
  <p>Thanks
  Yogaraj I</p>