1

My application uses devExpress "Office 2007" tabbed style. When I'm in a form and when I click a button that fills a DevExpress XtraGrid, the whole applicaiton freeze until the results are populated into the table.

How could I allow users to navigate to other "tabs" in my application while waiting for the results ?

Thank you !

:)

Martin Lebel
  • 497
  • 1
  • 6
  • 13
  • Use a `Task` or a `BackgroundWorker`. – Willem Jul 22 '12 at 21:57
  • 1
    Duplicate: http://stackoverflow.com/questions/1216791/c-sharp-winform-application-ui-hangs-during-long-running-operation – roken Jul 22 '12 at 22:19
  • 1
    While the overall concept is a duplicate, it can be hard for newer programmers to make that connection immediately. The solutions offered below are good for specific answers to the question given. – EtherDragon Jul 23 '12 at 21:48

2 Answers2

1

You want something like this:

Task.Factory.StartNew(
    () =>
    {
        var object = //Populate your grid

        this.yourXtraGrid.BeginInvoke(new Action(() =>
        {
            this.yourXtraGrid.ItemSource = object ;
        }));
    });
Willem
  • 9,166
  • 17
  • 68
  • 92
1

Have you looked into The instant feedback UI?

http://community.devexpress.com/blogs/thinking/archive/2010/11/11/winforms-grid-control-and-the-new-instant-feedback-ui.aspx

This is similar to their Async mode in PivotGrid if you are familiar with it.

From my experience you cannot update the grid from another thread.

E.T.
  • 949
  • 8
  • 21