3

In my WPF .Net Core application I receive messages from a message bus and need to assign the message data to properties that bind to my WPF frontend and hence need to move the incoming messages onto the UI thread. So far in .Net Framework 4.7.2 I have done so as follows:

Application.Current.Dispatcher.Invoke(() =>
            {
                _peerConnectionUpdatedCallback(peer);
            });

How can I do this now with my WPF .Net Core 3.1 application? Application (and Dispatcher) do not seem to exist in .Net Core anymore...

mm8
  • 163,881
  • 10
  • 57
  • 88
Matt
  • 7,004
  • 11
  • 71
  • 117

1 Answers1

2

Your code should work as-is on .NET Core 3.1 provided that you reference the Microsoft.NET.Sdk.WindowsDesktop SDK in your project (.csproj) file:

<Project Sdk="Microsoft.NET.Sdk.WindowsDesktop">
...

How can I add WPF items into a c# class library project in VS2019

mm8
  • 163,881
  • 10
  • 57
  • 88