public App() { InitializeComponent(); new AppDbContext(); MainPage = new TodoView(); }
public TodoPage() { //I don't like my views to be tightly coupled with pages, makes them more portable...personal preference. Content = todoView = new TodoView() { BindingContext = new TodoViewModel(new TodoService()) }; BindingContext = todoView.ViewModel; addListItem = new ToolbarItem { Text = "Add List", }; ToolbarItems.Add(addListItem); addListItem.SetBinding(ToolbarItem.CommandProperty, nameof(TodoViewModel.AddCommand)); }