.NET Framework Developer Center > .NET Development Forums > Windows Presentation Foundation (WPF) > WPF DataGrid to Indicate Loading/Searching in Progress; Best Way
Ask a questionAsk a question
 

AnswerWPF DataGrid to Indicate Loading/Searching in Progress; Best Way

  • Tuesday, November 03, 2009 3:46 AMOmegaManMVP, ModeratorUsers MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
    To the community: What is the best way to show a searching info message in a DataGrid?

    I have multiple background workers firing off to update different DataGrids upon startup. I need a way to show that data is being loaded and wondered what the community does.....
    William Wegerson (www.OmegaCoder.Com)

Answers

  • Thursday, November 05, 2009 4:05 PMJustTom Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     Answer
    No, it does not. It does not need. Would be overload.

    Just creaete a nice presentation / animation / whatever and put it onto the grid as adorner. Finished.

    I dont think this belongs to the grid in general - too usefull also on other controls ;)

All Replies

  • Wednesday, November 04, 2009 10:26 AMLinda LiuMSFT, ModeratorUsers MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     

    Hi William,

    Based on my understanding, you do some time-consuming work at background when the WPF application starts and want to show loading/searching progress in the UI. If I'm off base, please feel free to let me know.

    If you've experience in WinForm programming, you may know the BackgroundWorker component which was introduced in .NET Framework 2.0. The BackgroundWorker is designed for multiple threading programming. Fortunately, the BackgroundWorker component works also well in WPF application. 

    For more information on how to use BackgroundWorker, read the following article:
    "WPF Multithreading with BackgroundWorker"
    http://pavanpodila.spaces.live.com/blog/cns!9C9E888164859398!246.entry

    Hope this helps.
    If you have any question, please feel free to let me know.

    Sincerely,
    Linda Liu

    MSDN Subscriber Support in Forum 
    If you have any feedback on our support, please contact msdnmg@microsoft.com


    Please remember to mark the replies as answers if they help and unmark them if they provide no help.
    Welcome to the All-In-One Code Framework! If you have any feedback, please tell us.
  • Wednesday, November 04, 2009 3:05 PMOmegaManMVP, ModeratorUsers MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
    Hi Linda,

    I appreciate the reply and yes I am using background workers to do the actual work. Its easier to drag and drop the background worker component in winforms and I miss that...but I digress.

    What I am looking for though, is to not show blank gridviews, I have about five of them acquiring differing data from differing sources , while the operations are taking place. The user sees a blank grid and thinks no data and that is not what I want to do, for the grid is blank because the results are not in; not that no data has been returned.

    To avoid that, is there a way to place text in the grid in a quick fashion saying "Loading" or is there a standard way to show a progress bar in the gridview...or do I need to hide the gridview an put in a progress bar or message and then show when done?

    I was hoping that the MSDN community could shed light on what they do in such a situation that maybe I have overlooked.

    Thank you for the reply.
    William Wegerson (www.OmegaCoder.Com )
  • Thursday, November 05, 2009 8:29 AMLinda LiuMSFT, ModeratorUsers MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
    Hi William,

    Thank you for your quick response!

    > is there a way to place text in the grid in a quick fashion saying "Loading" or is there a standard way to show a progress bar in the gridview...

    When the background task begins, you can call the ReportProgress method on the BackgroundWorker, which will raise the ProgressChanged event on the BackgroundWorker. Subscribe the ProgressChanged event of the BackgroundWorker and show the "Loading" message in the event handler.

    Note that you need to set the BackgroundWorker.WorkerReportsProgress property to true so that the Background can report progress updates.

    For more information on the use of BackgroundWorker, please read the following MSDN document:
    http://msdn.microsoft.com/en-us/library/system.componentmodel.backgroundworker.aspx

    Hope this helps.

    If you have any question, please feel free to let me know.

    Sincerely,
    Linda Liu
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.
    Welcome to the All-In-One Code Framework! If you have any feedback, please tell us.
  • Thursday, November 05, 2009 3:56 PMOmegaManMVP, ModeratorUsers MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
    Subscribe the ProgressChanged event of the BackgroundWorker and show the "Loading" message in the event handler.

    Hi Linda,

    This thread is not about background workers. I am well versed with what the background worker can do.

    What I am looking to see if the gridview has a way to show a loading message inherently.  The question is what should that loading type of messessage be? Is it a label that simply says loading while the grid is invisible? Is it a progress bar while the grid is invisible? Is it a progress bar in the gridview? Or does the gridview have a way to quickly show a label on its surface that says loading?


    William Wegerson (www.OmegaCoder.Com)
  • Thursday, November 05, 2009 4:05 PMJustTom Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     Answer
    No, it does not. It does not need. Would be overload.

    Just creaete a nice presentation / animation / whatever and put it onto the grid as adorner. Finished.

    I dont think this belongs to the grid in general - too usefull also on other controls ;)
  • Friday, November 06, 2009 6:31 AMLinda LiuMSFT, ModeratorUsers MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
    Hi William,

    It's on you to decide how to show the "loading" message. Personaly, I perfer to show the blank DataGrid when the application starts and start an animation while the background task is executing.

    Sincerely,
    Linda Liu
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.
    Welcome to the All-In-One Code Framework! If you have any feedback, please tell us.