Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6678603
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T04:15:46+00:00 2026-05-26T04:15:46+00:00

I am trying to virtualize my user controls inside a ListView like this: <ListView

  • 0

I am trying to virtualize my user controls inside a ListView like this:

 <ListView VirtualizingStackPanel.IsVirtualizing="True"
                        VirtualizingStackPanel.CleanUpVirtualizedItem="stackPanel1_CleanUpVirtualizedItem"
                        VirtualizingStackPanel.VirtualizationMode="Standard"
                        Height="239" HorizontalAlignment="Left" Name="stackPanel1" VerticalAlignment="Top" Width="133" >              

                <ListView.Items>
                    <me:UserControl1 Backg="Green" />
                    <me:UserControl1 Backg="Blue" />
                    <me:UserControl1 Backg="Black" />
                    <me:UserControl1 Backg="Red" />
                    <me:UserControl1 Backg="Green" />
                    <me:UserControl1 Backg="Blue" />
                    <me:UserControl1 Backg="Black" />
                    <me:UserControl1 Backg="Red" />
                    <me:UserControl1 Backg="Blue" />
                    <me:UserControl1 Backg="Black" />
                     <me:UserControl1 Backg="Green" />
                    <me:UserControl1 Backg="Green" />
                </ListView.Items>
</ListView>

but, virtualizing dosen’t work, if I use a Rectangle as items, virtualzing just work, like this:

  <ListView VirtualizingStackPanel.IsVirtualizing="True"
                        VirtualizingStackPanel.CleanUpVirtualizedItem="stackPanel1_CleanUpVirtualizedItem"
                        VirtualizingStackPanel.VirtualizationMode="Standard"
                        Height="239" HorizontalAlignment="Left" Name="stackPanel1" VerticalAlignment="Top" Width="133" >              

                <ListView.Items>
                    <Rectangle Width="20" Height="20" Fill="Gray" ></Rectangle>
                <Rectangle Width="20" Height="20" Fill="Green"></Rectangle>
                <Rectangle Width="20" Height="20" Fill="Orange"></Rectangle>
                <Rectangle Width="20" Height="20" Fill="Blue"></Rectangle>
                <Rectangle Width="20" Height="20" Fill="Black"></Rectangle>
                <Rectangle Width="20" Height="20" Fill="Red"></Rectangle>
                <Rectangle Width="20" Height="20" Fill="Gray"></Rectangle>
                <Rectangle Width="20" Height="20" Fill="Green"></Rectangle>
                <Rectangle Width="20" Height="20" Fill="Orange"></Rectangle>
                </ListView.Items>
</ListView>

UserControl1 XAML is like this:

<UserControl x:Class="WpfApplication3.UserControl1"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
             Width="20" Height="20"
            >
    <Grid>
        <Rectangle Name="internalRect" Width="20" Height="20" Fill="Black"></Rectangle>
    </Grid>
</UserControl>

I use the event CleanUpVirtualizedItem to detect if virtualizing is working or not, while scrolling the view list, the event will be triggered only using Rectangles, but not the UserControl1, any idea ?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T04:15:46+00:00Added an answer on May 26, 2026 at 4:15 am

    How do you know that it works with rectangles? I really doubt it, rectangles are just extremely lightweight. If you create the items statically like that there cannot be any virtualization, the items are always going to be created. You need to set an ItemsSource and let the control create the items, for that you can set an ItemTemplate which contains the user-control.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Trying to get my css / C# functions to look like this: body {
Trying to do this sort of thing... WHERE username LIKE '%$str%' ...but using bound
I'm trying to visualize data like in this spreadsheet https://docs.google.com/spreadsheet/ccc?key=0AhtsNUEmDE6MdE0ybXppcG1jampsVnBfZWpEZm9vbmc . So I would
Trying to keep all the presentation stuff in the xhtml on this project and
I am trying to virtualize GPS device in android running in virtual-box. I want
I'm trying to figure out this virtualization feature, I'm not sure if I'm understanding
Like many these days, I am an old relational-model user approaching Cassandra for the
I'm trying to write an application that will allow a non-administrator user to create
The IT department where I work is trying to move to 100% virtualized servers,
I have a very large possible data set that I am trying to visualize

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.