Best way for add thousans items to listbox without freezing ui in wpf

Hello guys.
What is the best way for add thousands items (or even more) to Listbox without freezing UI.
I search many post in the web but I don't understand how this posts writer wrote that code.
I realized that ObservableCollection can contain 1000 items or even more and show that items to listbox just for few second without freezing UI but I don't Know how can I use that!
Can you guys give me an example.
thanks.

If you bind an observablecollection you can add items to that from a background thread.  Then bind that to the itemssource.  I usually new up an observablecollection, add the items then set the bound property to  that.
But I avoid thousands of items. 
You should provide some sort of filter mechanism the user chooses a category or whatever and then fill with a maximum of 300 items.
Users simply can't work with thousands of items.
It is usually reading the data out  a database which takes the time rather than creating objects to bind.
Hence this:
protected async override void GetData()
ThrobberVisible = Visibility.Visible;
ObservableCollection<CustomerVM> _customers = new ObservableCollection<CustomerVM>();
var customers = await (from c in db.Customers
orderby c.CustomerName
select c).ToListAsync();
foreach (Customer cust in customers)
_customers.Add(new CustomerVM { IsNew = false, TheEntity = cust });
Customers = _customers;
RaisePropertyChanged("Customers");
ThrobberVisible = Visibility.Collapsed;
That's making an asynchronous entity framework call.
A list of customers is obtained.
These are then wrapped in a customer viewmodel each.
Finally the observablecollection Customers is set to this new collection and propertychanged raised to notify the view.
The itemssource of a datagrid is bound to Customers.
Hope that helps.
Recent Technet articles: Property List Editing;
Dynamic XAML

Similar Messages

  • HT1535 The music I have in my i touch does not match or sync with music on my Mac.  What is the best way for me to sync both devices without losing any music?

    The muisc I have in my i-Touch does not match up with the music list in my Mac, therefore have issues syncing.  Is there anyway to keep all those songs without losing some of it?

    Some of the information below has subsequently appeared in a document by turingtest2: Recovering your iTunes library from your iPod or iOS device - https://discussions.apple.com/docs/DOC-3991
    Your i-device was not designed for unique storage of your media. It is not a backup device and media transfer was designed for you maintaining a master copy of your media on a computer which is itself properly backed up against loss. Syncing is one way, computer to device, updating the device content to the content on the computer, not updating or restoring content on a computer. The exception is iTunes Store purchased content.
    iTunes Store: Transferring purchases from your iOS device or iPod to a computer - http://support.apple.com/kb/HT1848 - only media purchased from iTunes Store
    For transferring other items from an i-device to a computer you will have to use third party commercial software. Examples (check the web for others; this is not an exhaustive listing, nor do I have any idea if they are any good):
    - Senuti - http://www.fadingred.com/senuti/
    - Phoneview - http://www.ecamm.com/mac/phoneview/
    - MusicRescue - http://www.kennettnet.co.uk/products/musicrescue/
    - Sharepod (free) - http://download.cnet.com/SharePod/3000-2141_4-10794489.html?tag=mncol;2 - Windows
    - Snowfox/iMedia - http://www.mac-videoconverter.com/imedia-transfer-mac.html - Mac & PC
    - iexplorer (free) - http://www.macroplant.com/iexplorer/ - Mac&PC
    - Yamipod (free) - http://www.yamipod.com/main/modules/downloads/ - PC, Linux, Mac [Still updated for use on newer devices? No edits to site since 2010.]
    - 2010 Post by Zevoneer: iPod media recovery options - https://discussions.apple.com/message/11624224 - this is an older post and many of the links are also for old posts, so bear this in mind when reading them.
    Syncing to a "New" Computer or replacing a "crashed" Hard Drive - https://discussions.apple.com/docs/DOC-3141 - dates from 2008 and some outdated information now.
    Copying Content from your iPod to your Computer - The Definitive Guide - http://www.ilounge.com/index.php/articles/comments/copying-music-from-ipod-to-co mputer/ - Information about use in disk mode pertains only to older model iPods.
    Get Your Music Off of Your iPod - http://howto.wired.com/wiki/Get_Your_Music_Off_of_Your_iPod - I am not sure but this may only work with some models and not newer Touch, iPhone, or iPad.
    Additional information here https://discussions.apple.com/message/18324797

  • What is the best way to add text to an image

    I used the draw ap div to add text to an image.  will that cause any problems?  If so, what is the best way to add text to an image?  Thanks!

    APDivs will kill your design unless you fully understand the css behind the scenes and plan accordingly. They really are completely unnecessary in the vast majority of situations.
    An easy way to add "web text over an image" would be to use the background-image attribute in css for a standard <div> tag, then just add the text within that same <div>.
    Something like this in the css (if you are using a 300x300 pixel image)...
    #yourdiv {
         background-image:url(yourpic.jpg);
         width:300px;
         height:300px;
    And then this in the html...
    <div id="yourdiv">Your text here</div>
    You would then position the <div> using css margins, floats and padding. Using position:absolute (APDivs) is typically something that will blow your design to pieces if the viewer changes their browser settings.

  • What is the best way to add hard disk space to macbook pro?

    I'm running out of disk space on my macbook pro. What is the best way to add disk space?

    another way of doing it is to replace your hard drive with a larger one.
    if you're technically capable, it takes 10 minutes for the swap and an hour minimum to clone your hard drive or do a data transfer.  all depends on how much data there is to trandfer or to clone.
    good luck.

  • What is the best way to add libraries to a project?

    What is the best way to add technologies to ADF? For example log4j. Or does the embedded logger have log4j features?

    HI,
    Hope helpful
    http://technology.amis.nl/blog/8380/manage-jdeveloper-external-libraries

  • Best way to add a new section in the middle of a tune?

    hi,
    what's best way to add a new section in the middle of a tune? I think I came up with an interesting transition to a tune... what's the best way to try it out?
    please be specific. if it's just select all and cut and move - I already know that one. somehow, I bet there's a better way.
    thanks in advance...

    You should be able to enter the "in" and out" points in the transport bar. And then under the Region menu, choose "Cut/Insert time."
    So if, for instance, you go up to bar 32, and want to add 8 bars, enter 32 1 1 1 in the top transport place, and 40 1 1 1 in the second. Then select "Cut/Insert Time", and an 8 bar whole will be added to your song.
    Be aware that if there are overlapping MIDI notes found at that cut point, Logic will warn you about it, and give you some options. In this case, I think "Keep" would be what you'd want, but every situation is different...
    Hope that helps....

  • Best way for building an application main frame

    I'm about to program a desktop application.
    The main frame will have menus, toolbar, status bar etc.
    There will be a lot of interaction between the menus, toolbar buttons and other custom gui components (such as an editor).
    My question is which is the best way for building it.
    Cramming all the code in one class file is out of the question.
    I thought about making my own custom JFrame and add API functions like for it so different GUI elements can be accessed.
    Each component which will be manipulated will be in its own class file with the constructor accepting a reference to my custom JFrame object which it is contained in.
    Any suggestions on the matter would be of great help since I've never done extensive Swing programming before.
    P.S.
    The application makes extensive use of RMI.
    What considerations should I take into account (except using SwingUtilities.invokeLater()) ?

    Hi,
    I have replied on this subject somewhere else today but what I do is have one simple entry point where I just instanciate a JFrame.
    On that frame I have a main JPanel. On that panel I add new objects like JPanels, tabs etc.
    I keep each new panel in a separate source as it is easier when the application grows, and it will. That also means that several programers can work with the same application without interfearing each other.
    I hope you understand what I mean the the thing is to split up the code into several sources.
    It may not suit everyone but I found this approach to be the best for me.
    Klint

  • Best way to add new post link

    What would be the best way to add a "new post" link on the main homepage that links to the appropriate blog page. Ideally, I'd like to put a small photo too.
    Is the only way to manually add it every time I update, or is there a better way?
    Thanks, Jill

    You can do it any number of ways. Link a shape, link text, or link a photo to the appropriate blog page, using the Inspector from the tool bar at the bottom of the iWeb window.
    You are correct that the only way is to manually update each time. I don't know of any method to get the blog entries to auto update an indicator on the Home page in iWeb.
    I have a site for a current project I'm on that has a "Shot of the Day" link on the Home page. As the site has gotten large, I have a duplicate of the Domain file for this site that contains nothing but this Home page. I update the page and then simply swap out the files on the server with the updated ones. Makes opening, editing, and saving the changes faster and easier than publishing the entire site each time. Here's an example of how I placed the link on the Home page...
    Mark

  • Best way for Crossjoin in MDX query

    Hi all,
    what is the best way for  for Cross join in MDX query
    Regards,
    Manish

    Hi Manish,
    In MDX, CrossJoin function returns the cross product of one or more sets. In your scenairo, what do you mean by best way for this function?
    When using CrossJoin function, we need to consider the performance of the query. If you cross-join medium-sized or large-sized sets (e.g., sets that contain more than 100 items each), you can end up with a result set that contains many thousands of items—enough
    to seriously impair performance. You can use the NonEmptyCrossjoin function instead of Corssjoin function. For the detail information, please see:
    http://sqlmag.com/data-access/cross-join-performance
    http://msdn.microsoft.com/en-us/library/ms144797.aspx
    Regards,
    Charlie Liao
    TechNet Community Support

  • What is the best way for my wife to sync her Outlook contacts to her new iPad Air?

    What is the best way for my wife to sync her Outlook contacts to her new iPad Air?  I don't know very much about Microsoft (almost nothing).  Does she need to plug into one of the USB ports on her Microsoft computer (about 5 years old)?  I also have an iMac (that I use for syncing but she needs her contacts from Outlook.  She doesn't really want all of them...there are 1,000's of teachers that work in her district and she does no tent to add 1,000's of contacts.

    If she only has a few she can e-mail those contacts to herself, open that mail on her iPad and save them from there.

  • What is the best way for my partner and I to share our work across computers?

    What is the best way for my business partner and I to share our work (projects, libraries, images) across computers without emailing items?  Is there creative cloud storage place we can share?

    Can't I just purchase the 200 GB storage, throw our photo library in it, share it with her, and have both of our new and future pics dumped into it?  If so, how do I do that?
    The iCloud Photo Library cannot be shared between users, unless you are using the same AppleID.
    You can share selected photos with shared albums:  iCloud: iCloud Photo Sharing FAQ
    Or create a Photos library on an external drive, that you both can access, as described here for iPhoto:   iPhoto: Sharing libraries among multiple users

  • What is the Best Way to add a shopping cart?

    What is the best way to add a shopping cart?
    Thanks.

    See that field at the top right that says "Search Forums"? Try Dreamweaver shopping cart. You'll get a lot of answers.

  • What are the best ways (for best performance) in MII to process the incoming process messages from shop floor systems to SAP ECC 6.0 and vice versa?

    Hi All,
    Can you please suggest to choose the best ways (for best performance) in MII (12.2 on NW 7.3), to process the incoming process messages from shop floor systems to SAP ECC 6.0 and vice versa?
    Thanks

    Hi Surya,
    Best practices for flow of data from ECC --> SAP MII --> Shop floor & Vice verse:
    1. Send ECC data through IDOC's/RFC's as messages to SAP MII message listener and BSL transaction process data and update directly on shop floor database as if you configured in Data services or later send those data by web service to shop floor system (i.e. depends on Shop floor machines).
    From Shop floor:
    shop floor --> SAP MII --> ECC
    1. Use either Web service or fetch data from DB and pass data to BAPI's  for sending to ECC through BLS transaction.
    Regards,
    Praveen Reddy

  • WHat is the best way for other iphone users to share pictures with me?  I am doing a project which req. people to send me 100 pictures at a time that I'll be putting in my iphoto?

    WHat is the best way for other iphone users to share pictures with me?  I am doing a project which req. people to send me 100 pictures at a time that I'll be putting in my iphoto? thank you.

    ingridlisa,
    I'd suggest to ask them to create Shared PhotoStreams and to invite you to view the streams, see:
    iCloud: Using and troubleshooting Shared Photo Streams
    Regards
    Léonie
    Added:
    that I'll be putting in my iphoto?
    Will you be collecting the photos in iPhoto on your iPhone or on a Mac? On a Mac a Shared PhotoStream requires Mac OS X 10.8.2.

  • Acrobat Standard XI, but can only find the CD for windows.  I have a mac (I have access to an external CD drive and I have the product keys for windows).  What is the best way for me to install it?

    Hi, I purchased Acrobat Standard XI, but can only find the CD for windows.  I have a mac (I have access to an external CD drive and I have the product keys for windows).  I have never installed it anywhere else.  What is the best way for me to install it?

    Hi lintonm86921521,
    I can understand your concern & will guide you through this.
    I am so sorry to inform you that Acrobat XI Standard is not available on Mac, you can only use it on your Windows computer.
    You can also refer to the system requirements at : System requirements | Acrobat family of products—older versions (XI, X, 9)
    In case if you have any further query please let us know, we will be happy to help you.
    Regards,
    Aadesh

Maybe you are looking for

  • Sender mail adapter - attachment name

    Hi there We have configured a sender email adapter to receive text/csv attachments and save them to a file system. What we are having a problem with is reading the attachment name. So we are using Dynamis Configuration to create the file name using t

  • Best Practice to Setup an application to work with both oracle and db2 db

    Hi, We have an application that currently supports both oracle and db2 databases . It is currently using JPA with eclipselink as backend mechanism and we want to move to ADFBc as our backend . So what is best practice to do this? I came across an old

  • How can i use  27" Thunderbolt to VGA moniter

    Hi. I have Mac mini late 2012 i7 and 27" thunderbolt display. How can i use 27" thunderbolt display through vga moniter. I use mac mini-->27" Thunderbolt -->mini DP to VGA adapter --> VGA moniter. I used before 27"iMac --> Mini DP to VGA adapter -->V

  • Lose network every time i try call???? help.

    Lose network every time i try call???? help.

  • I want the PCI-MIO-16-E4 ad board driver file.

    I am  doing research in aerospace department Anna university. i am using the hotwire annemometer. Data acquisition  purpose using the PCI-MIO-16-E4 AD board. The driver file of the board is corrupted. so request you to send the driver file. thank you