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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T19:31:19+00:00 2026-06-13T19:31:19+00:00

My WPF application has a lookup screen for selecting customers. The customer table contain

  • 0

My WPF application has a lookup screen for selecting customers. The customer table contain nearly 10,000 records. Its very slow when loading and filtering records using my Linq query(I am not doing any ordering of records). Is there a way to increase speed? Heard about using indexed views. Can someone please give some ideas?

lstCustomerData = dbContext.customers.Where(c => c.Status == "Activated").ToList();
            dgCustomers.ItemsSource = lstCustomerData;

filtering:

 string searchKey = TxtCustName.Text.Trim();

            var list = (from c in lstCustomerData
                        where (c.LastName == null ? "" : c.LastName.ToUpper()).Contains(searchKey.ToUpper())
                        select c).ToList();
            if (list != null)
                dgCustomers.ItemsSource = list;
  • 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-06-13T19:31:20+00:00Added an answer on June 13, 2026 at 7:31 pm

    Depends on what is slow. is the SQL Query slow? Is the UI rendering slow? Are you sorting/fintering in memory or going back to the DB?

    You should profile your app to find out exactly what the slowest piece is, then tackle that first.

    If the Linq query you added is what is slow then adding an index to the Status column in your database may help.

    You might get some improvement by changing your Where clause:

    var list = (from c in lstCustomerData
                where (c.LastName != null && c.LastName.ToUpper()).Contains(searchKey.ToUpper())
                select c).ToList();
    if (list != null)
        dgCustomers.ItemsSource = list; 
    

    since it doesn’t have to compare an empty string. However if you have very few NULL records than this probably won’t help much.

    In this case, however, all of the filtering is done in memory so using an indexed view in the DB won’t help unless you push the filtering back to the source repository.

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

Sidebar

Related Questions

I have a DataGrid in a WPF application which has for its ItemsSource a
I created a WPF application that has many buttons. Now the customer wants to
My WPF application has a number of buttons on its main window. I'm working
I have a View Model class in a WPF application that has some very
Im writing a WPF application that has a zoom and pan ability, but what
I have a wpf application using caliburn.micro. It has a datagrid and a combobox.
I need to write an WPF(4.0) application which has a DB but no tables
I need to convert my WPF application, which has a Ribbon , to use
It seems that when a WPF application starts, nothing has focus. This is really
I'm building WPF client application. I'm following MVC pattern. The project solution has many

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.