This thread looks to be a little on the old side and therefore may no longer be relevant. Please see if there is a newer thread on the subject and ensure you're using the most recent build of any software if your question regards a particular product.
This thread has been locked and is no longer accepting new posts, if you have a question regarding this topic please email us at support@mindscape.co.nz
|
Hello, I'm running into a problem where my property grid is sometimes very slow to graphically update. I'm using an ObservableDictionary with smart keys as my items source. As I get properties over a network connection, I add them to the dictionary (this requires me to use BeginInvoke to get the GUI thread to do the work. I've placed Console.WriteLine() calls in the places where the network interface gets the property, where the BeginInvoke takes place, and where the dictionary is actually added to. When adding 50+ properties, all three of those operations complete for all 50 properties in about a second, yet the property grid remains blank and my application's GUI locks up for nearly 10 seconds before the grid finally displays and everything is back to normal. Any ideas? Maybe I'm doing something obviously wrong? Thanks, - Mike - |
|
|
Hi Mike, I've not been able to reproduce this here -- on my test box, in Debug mode, it takes about 3 seconds to add 100 items and 1 second to add 50 (which I grant you is not blazingly fast, but it's not as bad as what you're describing). Would it be possible for you to put together a small repro project which demonstrates the problem please? I suggest that you just simulate the retrieval of properties on the background thread -- this will avoid any need for us to set up a database or network service or whatever your real data source is. You can attach zip files via the options tab or email them via the contact form (please remove any binaries first). Thanks! |
|
|
Hi Ivan, I will attach the repro project through the contact form. Thanks! |
|
|
Okay I couldn't find where to email things through the contact form, so here it is. On line 204 of PropertyGrid.xaml.cs if you change BeginInvoke to Invoke you can see the grid while it's populating, but it's still rather slow. Thanks for taking a look at this. - Mike - |
|
|
Mike, could you try changing your Console.WriteLine statements to Debug.WriteLine, and doing a release build for me? That makes a pretty dramatic difference for me, though I don't know if it will be enough to meet your speed requirements -- let us know. |
|
|
I made those same changes and ran it in release, but I'm still seeing the same amount of delay. I also discovered that it becomes more and more obvious with each click of the "Fake the data" button. The first time I click it, it takes about six seconds to populate the list, the second time takes 13 seconds, the third time takes 20+ seconds. |
|
|
The reason for the extra delay when clicking the button a second or third time is that it is adding additional data to the same dictionary / same grid, i.e. the dictionary is growing from 160 to 320 to 480 items, and the grid is having to do twice or three times as much of whatever it is. (I think it is measuring things, but haven't been able to establish this.) 6 / 13 / 20 seconds is a linear increase in timing with the number of data items, which is what I'd expect and is probably unavoidable, though obviously we'd like a much smaller scaling factor. Realistically I am guessing that when your users select a new object you will actually be retrieving a new set of properties, rather than appending those to the existing dictionary as you do in the sample app. Anyway, here is a suggestion for improving the performance -- for me this halves the initial load time, and keeps it constant when I press the button again: * Change resetGrid() to set propertyGrid.ItemsSource to null (instead of immediately making it use the new, empty dictionary). * Add the following two methods to your user control: internal void BeginPropertyLoad() * In your network interface code (in the repro app, the "Fake the Data!" button handler), call propertyGridControl.BeginPropertyLoad() before the first call to onAVPClientActorPropertyReceived, and propertyGridControl.EndPropertyLoad() after the last call. With these changes, in a release build, the data for your sample app (160+ grid entries) loads in a touch under 2 seconds. Could you give them a go and let me know what sort of performance you see? Thanks! |
|