Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7172441
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T15:36:58+00:00 2026-05-28T15:36:58+00:00

In my application i have a WPF Window that has a DataGrid in it.

  • 0

In my application i have a WPF Window that has a DataGrid in it. In Window_Loaded event I get JSON data from server and after deserializing it and converting it into a List<T> i bind that to my data grid. Everything is working fine this way.

The problem:

But the request part of code takes time and the whole window seems white with no elements loaded including the data grid.I want to make the request part asynchronous just as in AJAX we show a loader image while something is loading and then using a callback function to show the content when it is loaded.

In step by step

  1. Load the window and elements data grid buttons etc..
  2. Make web request to server and show ‘data is loading..’ in a label possibly.
  3. Fire an event or something that notifies that data has loaded and then bind the data grid to list so that the application remains responsive and active during whole web request part.

Here is the current non-async code i am using in Window_Loaded event handler

 WebResponse response = req.GetResponse();
 Stream responseStream = response.GetResponseStream();
 StreamReader sr = new StreamReader(responseStream, Encoding.UTF8);
 string JSON = sr.ReadToEnd();
 List<MyObject> returnedData = JsonConvert.DeserializeObject<List<MyObject>>(JSON);

i found this link but i am not sure how it is applicable to my problem. Any help or idea for how to go about this is welcome.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-28T15:36:59+00:00Added an answer on May 28, 2026 at 3:36 pm

    Use WebRequest.BeginGetResponse Instead of GetResponse, and assign the serialized result to List in callback method

    Don’t forgot that for assigning data from another thread to UI element created in another thread, you should send message to UI using dispatcher

    Hope this helps

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a WPF application that has several modal window used for various purposes.
I'm using MVVM in my WPF application. I have a Window that has a
I have window form in my WPF Application when I open new window from
i am porting my application from windows forms to WPF. I have found that
I have a Window that serves as a dialog in a WPF application. This
I have a WPF (C# and .NET 4) application that has a long running
I have a simple WPF window that has 12 buttons on it. I want
I have a WPF application that sometimes cannot be restored from the taskbar. This
I have written a WPF Line of Business application that has a particular sections
In my WPF application, I have a main window (Branch.xaml) which has a button

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.