public void AfterTargetUpdate() { bl.Property(model, x => x.Name).To(control.TextProperty()) .AfterTargetUpdate((binding, s) => { target = (IProperty <string>)binding.Target; source = (IProperty <string>)binding.Source; }); bl.Bind(); model.Name = "Hello World"; XAssert.IsNotNull(target); XAssert.IsNotNull(source); }
public void CanBindOneWay() { bl.Property(model, x => x.Name) .To(ui.Property(x => x.Text)) .OneWay(); bl.Bind(); bl.UpdateTarget(); Assert.Equal(model.Name, ui.Text); model.Name = "Updated value"; Assert.Equal(model.Name, ui.Text); }
public override async void ViewDidLoad() { base.ViewDidLoad(); var bounds = View.Bounds; _rssTable = new UITableView(new CGRect(0, 150, bounds.Width, bounds.Height - 100)); var innerTextField = new UITextField(new CGRect(bounds.Width * 0.1, 60, bounds.Width * 0.8, bounds.Width * 0.1)) { BackgroundColor = LightGray }; _feedSearchTextField = new TextField(innerTextField); // _button = new UIButton(new CGRect(bounds.Width * 0.1, 100, bounds.Width * 0.8, bounds.Width * 0.1)); // _button.SetTitle("refresh", UIControlState.Normal); // _button.BackgroundColor = LightGray; _viewModel.FeedFiltered += feed => { _tableSource.TableItems = feed.ToArray(); _rssTable.ReloadData(); }; _tableSource = new RssTableSource(); _rssTable.Source = _tableSource; Add(_feedSearchTextField); Add(_rssTable); // Add(_button); _bindingList.Property(_viewModel, _ => _.SearchStr) .To(_feedSearchTextField.TextProperty()) .UpdateTarget((t, s) => _feedSearchTextField.SetText((string)t.Target.Value)); _bindingList.Bind(); await _viewModel.Load("https://habrahabr.ru/rss/hubs/all"); _tableSource.TableItems = _viewModel.Feed.ToArray(); _rssTable.ReloadData(); }