Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions src/ReactiveUI.Tests/Mocks/PropertyBindViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ public class PropertyBindViewModel : ReactiveObject
private decimal _JustADecimal;
private double? _NullableDouble;
private int _JustAInt32;
private bool _JustABoolean;

public PropertyBindViewModel(PropertyBindModel? model = null)
{
Expand All @@ -46,6 +47,12 @@ public double JustADouble
set => this.RaiseAndSetIfChanged(ref _JustADouble, value);
}

public bool JustABoolean
{
get => _JustABoolean;
set => this.RaiseAndSetIfChanged(ref _JustABoolean, value);
}

public decimal JustADecimal
{
get => _JustADecimal;
Expand Down
10 changes: 10 additions & 0 deletions src/ReactiveUI.Tests/Platforms/windows-xaml/PropertyBindingTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -344,6 +344,16 @@ public void BindingToItemsControl()
Assert.True(itemsSourceValue.OfType<string>().Count() > 1);
}

[Fact]
public void OneWayBindConverter()
{
var vm = new PropertyBindViewModel();
var view = new PropertyBindView { ViewModel = vm };
var fixture = new PropertyBinderImplementation();
fixture.OneWayBind(vm, view, x => x.JustABoolean, x => x.SomeTextBox.IsEnabled, s => s);
Assert.False(view.SomeTextBox.IsEnabled);
}

[Fact]
public void BindExpectsConverterFuncsToNotBeNull()
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,7 @@ bool ViewToVmFunc(TVProp vValue, out TVMProp vmValue)
return null;
}

IObservable<object?> source = (IObservable<object?>)Reflection.ViewModelWhenAnyValue(viewModel, view, vmExpression).Select(x => (TProp)x).Select(selector);
IObservable<object?> source = Reflection.ViewModelWhenAnyValue(viewModel, view, vmExpression).Select(x => (object?)selector((TProp)x));

var (disposable, obs) = BindToDirect<TView, TOut, TOut>(source, view, viewExpression);

Expand Down