My problem is that my subscription to a nested property isn't responding.
Here's my XAML:
<TextBox Header="Enter test data:"
Text="{Binding UserEntryTest.Synced.Value, Mode=TwoWay}" />
The property in the view model (extract):
private EditableFieldSynced<string> userEntryTest;
public EditableFieldSynced<string> UserEntryTest
{
get { return userEntryTest; }
set { this.RaiseAndSetIfChanged(ref userEntryTest, value); }
}
The property Synced
in EditableFieldSynced<T>
is actually in a base class that inherits ReactiveObject
:
public T _synced;
public T Synced
{
get { return _synced; }
set { this.RaiseAndSetIfChanged(ref _synced, value); }
}
And in its contructor I subscribe to Synced
like this:
this.WhenAnyValue(x => x.Synced.Value) .Subscribe(x => this.ApplyLocalChanges(x));
Actually, whichever class I put in this subscription, it doesn't respond when the user inputs text...
I'm new to ReactiveUI, what am I doing wrong?
Of course, if I flatten the model with a property ValueSynced
in EditableFieldSynced<T>
that subscribes both ways to the changes of the based property Synced.Value
, it does fire, but I'd like to get it done in an automated way -- if possible.