Skip to content
This repository has been archived by the owner on May 1, 2024. It is now read-only.

Commit

Permalink
Update UI test
Browse files Browse the repository at this point in the history
Makes the UI test more understandable. It shows now a label with the actual resolved binding value. In the entry you can now see the value you provided.
  • Loading branch information
jonkas2211 authored and samhouts committed Aug 31, 2020
1 parent a196dfc commit 7a27f05
Showing 1 changed file with 37 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,12 @@ public class Issue7996 : TestContentPage
{
protected override void Init()
{
var vm = new ViewModelIssue7996();
BindingContext = vm;
var textLabel1 = new Label
{
Text = "Select culture:"
};
var picker = new Picker();
picker.ItemsSource = new[]
{
Expand All @@ -31,20 +37,48 @@ protected override void Init()
CultureInfo.CurrentUICulture = culture;
}
};

var textLabel2 = new Label
{
Text = "Resolved Binding Value:"
};
var bindingLable = new Label();
bindingLable.SetBinding(Label.TextProperty, new Binding(nameof(ViewModelIssue7996.MyDecimal), BindingMode.TwoWay));

var textLabel3 = new Label
{
Text = "Actual Value:"
};
var bindingLable2 = new Label();
bindingLable2.SetBinding(Label.TextProperty, new Binding(nameof(ViewModelIssue7996.MyDecimal), BindingMode.TwoWay));

var textLabel4 = new Label
{
Text = "Enter a number and watch result:"
};
var entry = new Entry();
entry.SetBinding(Entry.TextProperty, new Binding(nameof(ViewModelIssue7996.MyDecimal), BindingMode.TwoWay));
entry.Text = vm.MyDecimal.ToString();
entry.TextChanged += (s, e) =>
{
bindingLable.Text = e.NewTextValue;
};

var stackLayout = new StackLayout
{
Children =
{
textLabel1,
picker,
entry
textLabel2,
bindingLable,
textLabel3,
bindingLable2,
textLabel4,
entry,
}
};

Content = stackLayout;
BindingContext = new ViewModelIssue7996();
}
}

Expand Down

0 comments on commit 7a27f05

Please sign in to comment.