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 8826281
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T07:05:52+00:00 2026-06-14T07:05:52+00:00

In MVVM where the ViewModels update the Views via INotifyPropertyChanged events, there doesn’t seem

  • 0

In MVVM where the ViewModels update the Views via INotifyPropertyChanged events, there doesn’t seem to be much room for the cool feature of async/await; executing the continuation on the captured synchronization context of the invoker.

So, if this is the case, then who will actually use the features of async/await in a modern UI based app? In this context, “who” can also mean what pattern, e.g. MVC-variation.

I can think of the following as a good way of using TAP

ViewModel.Age
{
  set {
    await Model.SetAge(value);
    NotifyPropertyChanged("Age");
  }
}

however, having this run on the captured syncContext, does not really help out much.
Actually, we could put all this in the model instead.

Model.Age
{
  set {
    await SetAge(value);
    NotifyPropertyChanged("Age");
  }
}

and now, we would really like the syncContext NOT to be the captured one.

  • 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-06-14T07:05:52+00:00Added an answer on June 14, 2026 at 7:05 am

    Actually, having INotifyPropertyChanged.PropertyChanged raised in the UI synchronization context is required for data binding.

    async / await do force you to make a distinction between properties (which represent the current state and are always synchronous) and commands (which represent actions and may be synchronous or asynchronous). Property getters and setters cannot be async, so your example code with an “async set” is not a possible approach.

    async enables asynchronous commands. You can use command binding to asynchronously handle routed commands, or pass an async delegate to a DelegateCommand, or use your own ICommand implementation. Whichever way you’ll do it, you end up with an async void command event handler.

    A realistic example is to have the VM properties set the M properties in-memory, and have a SaveCommand with an async handler. It’s common to have async handlers interact with an additional VM property (SaveInProgress or maybe a common Busy shared with other async handlers) so that the UI can respond appropriately when the command is in progress (usually at least causing CanExecute to return false).

    So your async handler ends up looking something like:

    private async void SaveCommandExecute()
    {
      try
      {
        // Set VM property; updates View appropriately.
        Busy = true;
    
        // Do the actual saving asynchronously.
        await Model.SaveAsync();
      }
      catch (Exception ex)
      {
        // Update the VM with error information.
        Error = ex.Message;
      }
      finally
      {
        // Let the VM know we're done.
        Busy = false;
      }
    }
    
    private void SaveCommandCanExecute()
    {
      return !Busy;
    }
    

    Note that the VM properties (Error and Busy) are updated in the captured UI synchronization context.


    This illustrates the central concept of async MVVM: commands may be async, but the properties (such as Busy) always represent the current state.

    If you’re adding async to an existing MVVM app, you’ll find yourself with several additional properties indicating business and possibly also progress updates (e.g., percent complete). Depending on your application, you may permit multiple asynchronous operations at the same time. You’ll need to think of good ways to add this information to your Views; I find this to be the most challenging part of async MVVM apps.

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

Sidebar

Related Questions

Ok, I didn't want a bunch of ICommands in my MVVM ViewModels so I
I have an MVVM application. In one of the ViewModels is the 'FindFilesCommand' which
We're just getting into MVVM in WPF. We have implemented our ViewModels with 'strongly
My WPF application is structured using the MVVM pattern. The ViewModels will communicate asynchronously
I am trying to synchronize data between seperate Views in MVVM. Here is the
I'm starting to use MVVM,but I've been confused about something,there's my problem,I wanna add
I'm working with a charting tool that doesn't support binding in the mvvm sense.
A common approach for communication between 2 ViewModels is this: MVVM- View Model-View Model
I understand that in MVVM: the View knows about the ViewModel the ViewModel knows
Using the MVVM pattern creating WPF applications you have the ViewModel providing data to

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.