public AddAuthorPage() { InitializeComponent(); BindingContext = new AddAuthorViewModel(Navigation); AddTableSection.Add(new ViewCell { View = new ListView { // Source of data items. ItemsSource = ((AddAuthorViewModel)BindingContext).Author.Books, // Define template for displaying each item. // (Argument of DataTemplate constructor is called for // each item; it must return a Cell derivative.) ItemTemplate = new DataTemplate(() => { // Create views with bindings for displaying each property. Label nameLabel = new Label(); nameLabel.SetBinding(Label.TextProperty, "Title"); // Return an assembled ViewCell. return(new ViewCell { View = nameLabel }); }) } }); BackgroundColor = App.Current.MainPage.BackgroundColor; }
public AddAuthorPage(Book book, bool isAddToCatalogue) { InitializeComponent(); BindingContext = new AddAuthorViewModel(Navigation, book, isAddToCatalogue); BackgroundColor = App.Current.MainPage.BackgroundColor; }