Recently came across a need to make an async call within a property’s setter. Ok no big deal I’ll just add “async” to the property and use await. Unfortunately this is no allowed, but after a little research I found there is a way to make this happen and thankfully it’s just a line of code. Within the property setter logic do the following:
Deployment.Current.Dispatcher.InvokeAsync(async () => await MyMethodCallAsync());
Leave a Reply
You must be logged in to post a comment.