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

  • Home
  • SEARCH
  • 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 6136391
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T17:35:51+00:00 2026-05-23T17:35:51+00:00

About Data Virtualizatoin in WPF, the WPF: Data Virtualization is a good article. With

  • 0

About Data Virtualizatoin in WPF, the WPF: Data Virtualization is a good article.

With using this, Data Virtualization was executed as good in my code but there is the one problem, which is that I cannot bind a property in ViewModel with SelectedItem of ItemsControl in View. If one item of data satisfies some condition while data loads, the one item will be set as a property in ViewModel and then it will be bound with SelectedItem of ItemsControl in View, but will not.

My code about this is the following. About the types of IItemsProvider andVirtualizingCollection, please refer to the WPF: Data Virtualization.

So far, I have tried:

  1. I’m sure that if Data Virtualization were not used, the Selected Item Binding would be cool.
  2. The IndexOf(T item) method in VirtualizingCollection returns always -1. As thinking this would be the problem, I implemented that the IndexOf(T item) returns a actual index, but it was not concerned with this problem.

The code of implementing IItemsProvider

public class WordViewModelProvider : IItemsProvider<WordViewModel>
{
    private string _searchText = "some text";

    public WordViewModel SelectedItem
    {
        get;
        private set;
    }

    #region IItemsProvider<WordViewModel> Members
    public int FetchCount()
    {
        lock (_words)
        {
            int count = (from word in _words
                         where word.Name.Contains(_searchText)
                         select word).Count();
            return count;
        }
    }

    public IList<WordViewModel> FetchRange(int startIndex, int count)
    {
        lock (_words)
        {
            //Please, regard _word as IEnumerable<Word>
            IQueryable<Word> query = (from word in _words
                                      where word.Name.Contains(_searchText)
                                      select word);

            List<WordViewModel> result = query.ToList().ConvertAll(w =>
            {
                var wordViewModel = new WordViewModel(w, _searchText);
                if (w.Name.Equals(_searchText, StringComparison.InvariantCultureIgnoreCase))
                {
                    SelectedItem = wordViewModel;
                }
                return wordViewModel;
            });
            return result;
        }
    }
    #endregion
}

The code of using VirtualizingCollection in ViewModel

public void ViewList()
{
    var wordViewModelProvider = new WordViewModelProvider();
    var virtualizingCollection = new VirtualizingCollection<WordViewModel>(wordViewModelProvider);
    //IList<WordViewModel> type to bind with View's ItemsSource.
    WordViewModels = virtualizingCollection;
    //WordViewModel type to bind with View's SelectedItem
    SelectedItem = wordViewModelProvider.SelectedItem;
}
  • 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-23T17:35:51+00:00Added an answer on May 23, 2026 at 5:35 pm

    I would like to post good references about Virtualization to deal with large data set in WPF.

    • UI Virtualization vs Data Virtualization.

    For Virtualization approaches:

    • Paul McClean
    • Vincent Van Den Berghe
    • bea.stollnitz: He/She describes the solution that combines some of the best features of the two former and covers my issue.
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I was reading about data driven testing using mbunit from this article. http://blog.benhall.me.uk/2007/04/mbunit-datafixture-data-driven-unit.html I
How do you think about data access code like this: public void AddCusotmer(Cusotmer customer)
I need your suggest about data processing. My server is a data server (using
Today i was asked this question about sharing data from a thread t1 that
I want to answer questions about data in Erlang: count things, correlate messages, provide
I have a few questions about data synchronization. The architecture does not seem to
I am currently teaching myself about various data strutures and am a little frustrated
Has anyone found any documentation or research about what data is transfered to Google
I have a PHP-generated page which is displaying some data about a set of
What method do you use when you want to get performance data about specific

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.