Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@tomwis
Created October 22, 2017 17:33
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tomwis/d554d74dc5079202e5d5b7052cff95da to your computer and use it in GitHub Desktop.
Save tomwis/d554d74dc5079202e5d5b7052cff95da to your computer and use it in GitHub Desktop.
public partial class MainPage : ContentPage, IViewFor<MainViewModel>
{
public MainPage()
{
InitializeComponent();
ViewModel = new MainViewModel(new MovieService());
this.Bind(ViewModel, vm => vm.SearchTerm, v => v.entryField.Text);
this.OneWayBind(ViewModel, vm => vm.Results, v => v.resultList.ItemsSource);
this.OneWayBind(ViewModel, vm => vm.IsSearching, v => v.loadingBar.IsVisible);
}
public MainViewModel ViewModel { get; set; }
object IViewFor.ViewModel
{
get => ViewModel;
set => ViewModel = (MainViewModel)value;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment