Home Forums WPF controls Xceed DataGrid for WPF Correct way to renew ItemsSource (LINQ)

Viewing 8 posts - 1 through 8 (of 8 total)
  • Author
    Posts
  • User (Old forums)
    Member
    Post count: 23064
    #23758 |

    Hi,

    your grid, as you probably know, is a true gift to the community! I’m really glad the project exists and I’m really eager to use it. As I started to experiment with it I’ve run into some problems. Let me explain.

    I’ve built a simple test app. The data model is like Firm -> Employee.
    Firms are displayed in Combobox, employees are displayed in DataGridControl (version 1.1).

    In Combobox SelectionChanged event I have the following code:

    //A query, db is DataContext
    var employees = from e in db.employees ……
    where e.firm_id == (int)comboBox.SelectedValue…

    //Clear the grid, these lines are taken from samples
    grid.ClearValue(DataGridControl.ItemsSourceProperty);
    grid.Items.Clear();

    //Assign new data
    DataGridCollectionView dataGridCollectionView = new DataGridCollectionView( employees );
    grid.ItemsSource = dataGridCollectionView;

    I have 2 problems with this approach:
    1) There seems to be a memory leak: Windows TaskManager shows that memory consuptions grows as I select different firms. It grows even when I call GC.Collect() directly. What am I doing wrong?

    2) There is a noticeable delay when refreshing data (fullscreen window, stretched grid). I’ve put
    Mouse.OverrideCursor = Cursors.Wait; at the beginning of the event and
    Mouse.OverrideCursor = Cursors.Arrow; at the end.
    Also I’m executiong the LINQ query immediately:
    var employees = ( from…).ToList();

    But nevertheless I have about 1,5..2 second delay (6 columns, about 100 rows) AFTER the cursor changes back.

    What could I do to improve performance? Wait for future versions of .NET 3.5 framework? Use fixed coulms instead of dynamic?

    Thanks again for the control and for any suggestions,

    Lux

    Imported from legacy forums. Posted by Andres (had 1004 views)

    Xceed Support
    Member
    Post count: 5658

    1) Could you provide a simple repro application… leaks are rather hard to investigate and this would help a lot.

    2) The delay you experienced is caused by the time required to generate, measure and arrange one full page of data. At the moment, I don’t think there are much you can do to avoid this delay

    Imported from legacy forums. Posted by Marcus [Xceed] (had 332 views)

    User (Old forums)
    Member
    Post count: 23064

    1) Where’d I send it (0,5MB)? My address is lux44@hot.ee.

    Imported from legacy forums. Posted by Andres (had 211 views)

    Xceed Support
    Member
    Post count: 5658

    you can send it to support@xceedsoft.com

    Make sure to indicate that the application is for this forum thread…. and you could reference me as well…

    Imported from legacy forums. Posted by Marcus [Xceed] (had 229 views)

    User (Old forums)
    Member
    Post count: 23064

    Did you manage to reproduce the leak (I didn’t find anything related in 1.2 release notes)?

    Regards

    Imported from legacy forums. Posted by Andres (had 281 views)

    Xceed Support
    Member
    Post count: 5658

    No fix is present in version 1.2 for this particular issue…

    Rest assured this issue it is in our list of things to do and we’ll post directly in this thread as we have updates.

    Imported from legacy forums. Posted by Marcus [Xceed] (had 374 views)

    Xceed Support
    Member
    Post count: 5658

    Hi lux,

    We had time to check the program you sent us… and we did not detect any leak when changing the datagrid source.

    We made the tests using the VS2008 Beta 2 release of LINQ to SQL… we had to recreate the LINQ to SQL classes as some compatibility issues appeared between your project and the latest version…

    Can you reconfirm that the leak is not apparent with VS2008 Beta 2?

    Imported from legacy forums. Posted by Marcus [Xceed] (had 615 views)

    User (Old forums)
    Member
    Post count: 23064

    > Can you reconfirm that the leak is not apparent with VS2008 Beta 2?

    Yes.
    Memory usage climbs form initial 46 MB up to 81 MB, but not higher, generally hovering around 70 MB.

    Thank you for your time!
    Regards

    Imported from legacy forums. Posted by Andres (had 6008 views)

Viewing 8 posts - 1 through 8 (of 8 total)
  • You must be logged in to reply to this topic.