Reputation: 724
I have pretty simple ReactiveObject
ViewModel, where properties are ReactiveObject
s.
In view I have following binding:
this.OneWayBind(ViewModel,
vm => vm.CurrentEditor.SelectedTreeViewItem.ItemTitle,
v => v.CurrentSelectionImage.ToolTip);
Is it possible to set Tooltip to null
when CurrentEditor
becomes null
?
Upvotes: 1
Views: 524
Reputation: 2962
This is the expected behavior as per the docs.
There may be a better way to achieve it, but at the very least you can use WhenAnyValue and bind it to both CurrentEditor and CurrentEditor.SelectedTreeViewItem.ItemTitle:
ViewModel.WhenAnyValue(vm => vm.CurrentEditor,
vm => vm.CurrentEditor.SelectedTreeViewItem.ItemTitle,
(ce, title) => ce == null ? null : title)
.BindTo(this, v => v.CurrentSelectionImage.ToolTip);
Upvotes: 1