Hello,
You can do this by extending ObservableObject for your Model as well. ObservableObject provides a base implementation for INotifyPropertyChanged and INotifyPropertyChanging that could make your property in the Model update at the runtime.
public class InfoModel: ObservableObject
{
private string name;
public string Name
{
get => name;
set => SetProperty(ref name, value);
}
private string address;
public string Address
{
get => address;
set => SetProperty(ref address, value);
}
}
After receiving the data from the WebSocket. You can set the value to the Info object directly with Info.Address = "Your Address from WebSocket";
or Info.Name="your name from the WebSocket"
in your Viewmodel.
Best Regards, Leon Lu
If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment". Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.