I have a Client MyClient
which provides new stati via an IObservable
. As described in the documentation (https://reactiveui.net/docs/handbook/view-models/boilerplate-code) I made a private property of type ObservableAsProperty
to get the output of my IObservable
. But know my GUI is not updated automatically on changes.
public partial class MainWindow : ReactiveWindow<AppViewModel>
{
public MainWindow()
{
InitializeComponent();
ViewModel = App.Container.GetInstance<AppViewModel>();
this.WhenActivated(r =>
{
this.OneWayBind(ViewModel, viewModel => viewModel.Status.AoiStatus, view => view.StatusTxtbl.Text).DisposeWith(r);
});
}
}
public class AppViewModel : ReactiveObject
{
public IStatus Status { [ObservableAsProperty] get; }
public MyClient Client { get; }
public AppViewModel(MyClient client)
{
Client = client;
Client.StatusStream().ToPropertyEx(this, x => x.Status);
}
}
public interface IStatus
{
string AoiStatus { get; }
}
If I bind the gui via xaml
with my DataContext
, everything works as expected. ViewModel.PropertyChanged
is fired, so I don't know what's wrong there?!