Exemplo n.º 1
0
        public AddPublisherPage()
        {
            InitializeComponent();
            BindingContext = new AddPublisherViewModel(Navigation);

            AddTableSection.Add(new ViewCell
            {
                View = new ListView
                {
                    // Source of data items.
                    ItemsSource = ((AddPublisherViewModel)BindingContext).Publisher.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;
        }
Exemplo n.º 2
0
 public AddPublisherPage(Book book, bool isAddToCatalogue)
 {
     InitializeComponent();
     BindingContext  = new AddPublisherViewModel(Navigation, book, isAddToCatalogue);
     BackgroundColor = App.Current.MainPage.BackgroundColor;
 }