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 7576393
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T16:54:33+00:00 2026-05-30T16:54:33+00:00

EDITED for clarity: I have 2 ListView i my application. The first one contains

  • 0

EDITED for clarity:

I have 2 ListView i my application. The first one contains a List < KeyPair< String, List< Elements > >. The display of the items in the list is templated to show only the Key (String). When the user selects an item in this lists (SelectionChanged), it changes the ItemSource of my second ListView to the Value of the Keypair.

This is placed inside a Grid with a Column width of Auto.

<ListView ItemsSource="{Binding Path=FunctionIndex.Index}"
          Name="completeFunctionIndexView"        
          Style="{StaticResource SearchListStyle}"
          SelectionChanged="functionIndexView_SelectionChanged" />

<ListView Name="SearchResults" 
          VirtualizingStackPanel.IsVirtualizing="True"
          VirtualizingStackPanel.VirtualizationMode="Recycling">
              <ListView.View>
                 <GridView >
                    <GridViewColumn 
                                 CellTemplate="{StaticResource ElementLV}"
                                 Width="Auto"/>
                 </GridView>
              </ListView.View>
           </ListView>

The Style SearchListStyle only constains a TextBlock showing the Key (since it contains KeyPairs).
ElementLV is a small Text block with Runs bound to diverse properties and ToString values of my elements.

private void functionIndexView_SelectionChanged(object sender, SelectionChangedEventArgs e)
     {
     //This supposes we want to support a "multiple selection search"
     //for now this isn't implemented
     List<Element> Results = new List<Element>();

     foreach (KeyValuePair<String, List<Element>> item in e.AddedItems)
        {
        Results = item.Value;
        break;
        }

     SearchResults.ItemsSource = Results;
     }

These list which can be displayed in the SearchResults listview can have large number of elements (100k+). I’ve put the IsVirtualizing on the second listview, and most of the time it works like charm.

But sometimes, I can’t quite put my finger on what causes it (too quick a click to select an item maybe? ) the application decides it must generates all the items in the list (which is not wanted obviously)…

Can someone point me in the right direction? Is there a reason why the SearchResults would decide to ask to generate all items?

Could it be linked to the Width of the items and the SearchResults ListView, when Measuring, trying to measure ALL its items?

  • 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-30T16:54:34+00:00Added an answer on May 30, 2026 at 4:54 pm

    I have found the situation which caused my List to generate all elements. It has to do with the ListView to have no specified Width, and beeing in a Container with Auto (a grid column with Auto ) as Width. It seems in certain condition which I’m not sure yet, the ListView tries to generate all the elements to measure their Width instead of using only those currently visible.

    I’m think it didn’t always do that, but in this particular situation in my application, now it does…

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

Sidebar

Related Questions

--edited for clarity (hopefully) I have an XML file that looks something like this:
I have such query (generated by Hibernate - edited for more clarity - below
I have a string which could contain several different values, among them are. EDITED
g++ (Ubuntu 4.4.3-4ubuntu5) 4.4.3. Edited for clarity. I have a shared library in which
Question edited for clarity I make an AJAX call, using the $.getJSON() method, and
EDITED: Im developing SMS application in java for reading SMS .Im sending AT commands
Edited to Add * I haven't found a solution for this one yet, can
I have a Java class representing an event that contains some data, and also
Edited to clarify my intent: (based on initial answers) I have a web app.
Edited for a little clarity So ... I must be misunderstanding how to properly

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.