コード例 #1
0
        private async void PopulateContacts()
        {
            var vm = (MainViewModel)this.BindingContext;
            await vm.HydrateContactsMainViewModel();

            this.Contacts.HasUnevenRows     = true;
            this.Contacts.ItemsSource       = vm.Contacts;
            this.Contacts.WidthRequest      = ((Page)this).Width * 7 / 8;
            this.Contacts.HeightRequest     = ((Page)this).Height * 2 / 3;
            this.ContactsBG.WidthRequest    = ((Page)this).Width * 7 / 8;
            this.ContactsBG.HeightRequest   = ((Page)this).Height * 10 / 25;
            this.Contacts.HorizontalOptions = LayoutOptions.Center;
            this.Contacts.ItemTapped       += (s, e) => Navigation.PushModalAsync(
                new ContactDetailView
            {
                ContactDetailsVm = new ContactDetailsViewModel(
                    ((ListView)
                     s).SelectedItem as Contact)
            }, false);
            this.Contacts.ItemTemplate = new DataTemplate(() =>
            {
                var what = new ImageCell();
                what.SetBinding(ImageCell.TextProperty, "Name");
                what.SetBinding(ImageCell.ImageSourceProperty, "PicUrl");
                what.SetBinding(ImageCell.DetailProperty, "Phone");
                vm.IsBusy = false;
                return(what);
            });
        }
コード例 #2
0
        public GalleryPage()
        {
            Title       = "Gallery";
            ImageModels = new List <Image>();
            for (var i = 0; i < 7337; i++)
            {
                var a = new Image
                {
                    Title = Guid.NewGuid().ToString(), ImagePath = "cat.png"
                };
                ImageModels.Add(a);
            }

            var listView = new ListView(ListViewCachingStrategy.RecycleElement)
            {
                HasUnevenRows = true,
                ItemsSource   = ImageModels,
                ItemTemplate  = new DataTemplate(() =>
                {
                    var imageCell = new ImageCell {
                        TextColor = Color.Black, DetailColor = Color.Green
                    };
                    imageCell.SetBinding(TextCell.TextProperty, "Title");
                    imageCell.SetBinding(ImageCell.ImageSourceProperty, "ImagePath");
                    return(imageCell);
                })
            };

            listView.ItemTapped += OnItemTapped;
            Content              = new StackLayout {
                Children = { listView }
            };
        }
コード例 #3
0
        public PitaniePage()
        {
            InitializeComponent();
            Pitanie = new List <Sport>
            {
                new Sport {
                    Title = "ICONFIT BCAA 2:1:1, 400g", Title1 = "\nВысококачественный аминокислотный комплекс с разветвленной цепью с более высоким " +
                                                                 "содержанием аминокислот, чем у большинства конкурирующих продуктов.", Company = "IconFit", Price = "16€", ImagePath = "bcaa.jpg"
                },
                new Sport {
                    Title = "Protein.Buzz Whey Isolate 2000g", Title1 = "\nВ 1 порции:\n -20. 8 г белка (обогащенный ВСАА и L-глютамином)" +
                                                                        "\n- низкое содержание жира и только 1 г углеводов \n- без сахара \n- без аспартама", Company = "Protein.Buzz", Price = "47€", ImagePath = "prbuzz.jpg"
                },
                new Sport {
                    Title = "Optimum Nutrition 100% Gold Standard Casein 1,8kg", Title1 = "24 грамма высококачественного, укрепленного энзимами " +
                                                                                          "антикатаболический мицеллярный казеин 10 грамм BCAA, глютамина в одной мерной ложке Улучшенный AMINOGEN", Company = "Optimum Nutrition", Price = "62€", ImagePath = "gs.jpg"
                },
                new Sport {
                    Title = "SAN 100% Pure Titanium Whey, 2.27kg", Title1 = "100% Pure Titanium Whey был создан для того, чтобы максимально" +
                                                                            " противодействовать послетренировочному катаболизму " +
                                                                            "(разрушению мышц), а его анаболическое действие длится ДО 4 ЧАСОВ.", Company = "SAN", Price = "49€", ImagePath = "san.jpg"
                },
                new Sport {
                    Title = "Mutant Mass, 2270g", Title1 = "Mutant Mass — супермощный гейнер для набора мышечной массы, " +
                                                           "обеспечивающий максимальный рост мышечной массы и полноценное восстановление после тренировок в течение всего дня..."
                    , Company = "Mutant", Price = "23€", ImagePath = "mut.jpg"
                }
            };
            Label header = new Label
            {
                Text      = "Лучшее За свою цену",
                FontSize  = Device.GetNamedSize(NamedSize.Large, typeof(Label)),
                TextColor = Color.White
            };
            ListView listView = new ListView
            {
                HasUnevenRows = true,
                ItemsSource   = Pitanie,
                // Определяем формат отображения данных
                ItemTemplate = new DataTemplate(() =>
                {
                    ImageCell imageCell = new ImageCell {
                        TextColor = Color.White, DetailColor = Color.White
                    };
                    imageCell.SetBinding(ImageCell.TextProperty, "Title");
                    Binding companyBinding = new Binding {
                        Path = "Price", StringFormat = "цена:{0}"
                    };
                    imageCell.SetBinding(ImageCell.DetailProperty, companyBinding);
                    imageCell.SetBinding(ImageCell.ImageSourceProperty, "ImagePath");
                    return(imageCell);
                })
            };

            listView.ItemTapped += OnItemTapped;
            this.Content         = new StackLayout {
                Children = { header, listView }
            };
            this.BackgroundColor = Color.Black;
        }
コード例 #4
0
ファイル: Cart.cs プロジェクト: 4elus/XamarinC-
        private void update()
        {
            ListView listView = new ListView
            {
                HasUnevenRows = true,
                ItemsSource   = BagCoffee,
                // Определяем формат отображения данных
                ItemTemplate = new DataTemplate(() =>
                {
                    ImageCell imageCell = new ImageCell {
                        TextColor = Color.Red, DetailColor = Color.Green
                    };
                    imageCell.SetBinding(ImageCell.TextProperty, "Title");
                    Binding companyBinding = new Binding {
                        Path = "Price", StringFormat = "Цена:  {0}"
                    };
                    imageCell.SetBinding(ImageCell.DetailProperty, companyBinding);
                    imageCell.SetBinding(ImageCell.ImageSourceProperty, "ImagePath");
                    return(imageCell);
                })
            };

            listView.ItemTapped += OnItemTapped;
            this.Content         = new StackLayout {
                Children = { header, back, listView, stackLayout, address, cart, btn_сonfirmation }
            };
        }
コード例 #5
0
        public CalendarPage()
        {
            Notes = new List <notes>
            {
                new notes {
                    MoodName = "Чудово", Emotions = "Радість, Натхнення", Activities = "Малювання", ImagePath = "awsome.png"
                },
                new notes {
                    MoodName = "Добре", Emotions = "Задоволення", Activities = "Робота", ImagePath = "good.png"
                },
            };

            InitializeComponent();
            ListView listView = new ListView
            {
                HasUnevenRows = true,
                ItemsSource   = Notes,
                // Определяем формат отображения данных
                ItemTemplate = new DataTemplate(() =>
                {
                    ImageCell imageCell = new ImageCell {
                        TextColor = Color.Red, DetailColor = Color.Green
                    };
                    imageCell.SetBinding(ImageCell.TextProperty, "MoodName");
                    Binding emBinding = new Binding {
                        Path = "Emotions", StringFormat = "Флагман от компании {0}"
                    };
                    imageCell.SetBinding(ImageCell.DetailProperty, emBinding);

                    imageCell.SetBinding(ImageCell.ImageSourceProperty, "ImagePath");
                    return(imageCell);
                })
            };
        }
コード例 #6
0
        public MenuPage()
        {
            InitializeComponent();

            MenuPageViewModel menuPageViewModel = new MenuPageViewModel();

            BindingContext = menuPageViewModel;

            lstOptions              = new ListView();
            lstOptions.ItemsSource  = menuPageViewModel.Options;
            lstOptions.ItemTemplate = new DataTemplate(() => {
                var imageCell = new ImageCell();
                imageCell.SetBinding(TextCell.TextProperty, "optionName");
                imageCell.SetBinding(ImageCell.ImageSourceProperty, "IconSource");
                return(imageCell);
            });
            lstOptions.VerticalOptions     = LayoutOptions.FillAndExpand;
            lstOptions.SeparatorVisibility = SeparatorVisibility.None;

            Content = new StackLayout
            {
                VerticalOptions = LayoutOptions.FillAndExpand,
                Children        = { lstOptions }
            };
        }
コード例 #7
0
        public MainMenuPage()
        {
            listView = new ListView()
            {
                ItemsSource  = PopulateMenu(),
                ItemTemplate = new DataTemplate(() =>
                {
                    var imageCell = new ImageCell();
                    imageCell.SetBinding(TextCell.TextProperty, "Title");
                    imageCell.SetBinding(ImageCell.ImageSourceProperty, "IconSource");
                    return(imageCell);
                }),
                VerticalOptions     = LayoutOptions.FillAndExpand,
                SeparatorVisibility = SeparatorVisibility.None
            };

            Padding = new Thickness(0, 40, 0, 0);
            Icon    = "hamburger.png";
            Title   = "Stratedge.me Monitor";

            Content = new StackLayout()
            {
                Children =
                {
                    listView
                },
                VerticalOptions = LayoutOptions.FillAndExpand
            };
        }
コード例 #8
0
        public MasterPage()
        {
            var masterPageItems = new List <MasterPageItem>();

            masterPageItems.Add(new MasterPageItem
            {
                Title      = "Profile",
                IconSource = "avatar.png",
                TargetType = typeof(ProfilePage)
            });

            masterPageItems.Add(new MasterPageItem
            {
                Title      = "AlexandruP",
                IconSource = "avatar.png",
                TargetType = typeof(AlexandruP)
            });

            masterPageItems.Add(new MasterPageItem
            {
                Title      = "AndradaH",
                IconSource = "avatar.png",
                TargetType = typeof(AndradaH)
            });

            masterPageItems.Add(new MasterPageItem
            {
                Title      = "VladO",
                IconSource = "avatar.png",
                TargetType = typeof(VladO)
            });

            listView = new ListView
            {
                ItemsSource  = masterPageItems,
                ItemTemplate = new DataTemplate(() => {
                    var imageCell = new ImageCell();
                    imageCell.SetBinding(TextCell.TextProperty, "Title");
                    imageCell.SetBinding(ImageCell.ImageSourceProperty, "IconSource");
                    return(imageCell);
                }),
                VerticalOptions     = LayoutOptions.FillAndExpand,
                SeparatorVisibility = SeparatorVisibility.None
            };

            Padding = new Thickness(20, 20, 20, 20);
            Icon    = "avatar.png";
            Title   = "MicrosoftJam";
            Content = new StackLayout
            {
                VerticalOptions = LayoutOptions.FillAndExpand,
                Children        =
                {
                    listView
                }
            };
        }
コード例 #9
0
        public MainPage()
        {
            Persones = new List <Person>
            {
                new Person {
                    Name = "Alex1", Image = "Alex1.jpg", Number = "+3753334350"
                },
                new Person {
                    Name = "Alex2", Image = "Alex2.jpg", Number = "+3753334351"
                },
                new Person {
                    Name = "Alex3", Image = "Alex3.jpg", Number = "+3753334352"
                },
                new Person {
                    Name = "Alex4", Image = "Alex4.jpg", Number = "+3753334353"
                },
                new Person {
                    Name = "Alex5", Image = "Alex5.jpg", Number = "+3753334354"
                },
                new Person {
                    Name = "Alex6", Image = "Alex6.jpg", Number = "+3753334355"
                }
            };

            Label header = new Label
            {
                Text              = "Список контактов",
                FontSize          = Device.GetNamedSize(NamedSize.Large, typeof(Label)),
                HorizontalOptions = LayoutOptions.Center
            };
            ListView listView = new ListView
            {
                HasUnevenRows = true,
                ItemsSource   = Persones,

                ItemTemplate = new DataTemplate(() =>
                {
                    ImageCell imageCell = new ImageCell {
                        TextColor = Color.Black, DetailColor = Color.Black
                    };
                    imageCell.SetBinding(ImageCell.TextProperty, "Name");

                    Binding numberBinding = new Binding {
                        Path = "Number"
                    };
                    imageCell.SetBinding(ImageCell.DetailProperty, numberBinding);
                    imageCell.SetBinding(ImageCell.ImageSourceProperty, "Image");
                    return(imageCell);
                })
            };

            listView.ItemSelected += OnListViewItemSelected;
            this.Content           = new StackLayout {
                Children = { header, listView }
            };
        }
コード例 #10
0
        public MasterPageCS()
        {
            var masterPageItems = new List <MasterPageItem>();

            BackgroundImage = "bg.jpg";
            masterPageItems.Add(new MasterPageItem
            {
                Title      = "Add Building",
                IconSource = "",
                TargetType = typeof(LocationView)
            });
            masterPageItems.Add(new MasterPageItem
            {
                Title      = "Building List",
                IconSource = "",
                TargetType = typeof(LocationList)
            });
            masterPageItems.Add(new MasterPageItem
            {
                Title      = "Sync with Server",
                IconSource = "",
                TargetType = typeof(BuildingListPage)
            });

            listView = new ListView
            {
                ItemsSource  = masterPageItems,
                ItemTemplate = new DataTemplate(() =>
                {
                    var imageCell = new ImageCell();
                    imageCell.SetBinding(TextCell.TextProperty, "Title");
                    imageCell.SetBinding(ImageCell.ImageSourceProperty, "IconSource");
                    return(imageCell);
                }),
                VerticalOptions     = LayoutOptions.FillAndExpand,
                SeparatorVisibility = SeparatorVisibility.None,
                BackgroundColor     = Color.Black,
                RowHeight           = 80,
                Margin = 0,
            };

            //Padding = new Thickness(0, 40, 0, 0);
            //Icon = "hamburger.png";
            Title   = "PPM";
            Content = new StackLayout
            {
                VerticalOptions = LayoutOptions.FillAndExpand,
                BackgroundColor = Color.Black,
                //Opacity=0.7,
                Children =
                {
                    listView
                }
            };
        }
コード例 #11
0
        public Pictures()
        {
            Title = "Pictures";

            //Format sort button
            sortButton.Text            = " Sort by... ";
            sortButton.BackgroundColor = Color.FromHex("50D859");
            sortButton.TextColor       = Color.FromRgb(255, 255, 255);
            sortButton.Margin          = 5;
            sortButton.BorderColor     = Color.FromRgb(0, 0, 50);
            sortButton.HeightRequest   = 25;
            sortButton.WidthRequest    = 75;

            //Format view button
            viewButton.Text            = " View ";
            viewButton.BackgroundColor = Color.FromHex("A450D8");
            viewButton.TextColor       = Color.FromRgb(255, 255, 255);
            viewButton.Margin          = 5;
            viewButton.HeightRequest   = 25;
            viewButton.WidthRequest    = 75;
            viewButton.BorderColor     = Color.FromRgb(0, 0, 50);
            viewButton.IsVisible       = false;

            //initialize list of content
            _list              = new ListView();
            _list.ItemsSource  = Sample.App.Pics;
            _list.ItemTemplate = new DataTemplate(() =>
            {
                var cell = new ImageCell();
                cell.SetBinding(ImageCell.TextProperty, "Title");
                cell.SetBinding(ImageCell.ImageSourceProperty, "Thumb");
                return(cell);
            });

            //Enable events
            _list.ItemSelected += _list_ItemSelected;
            sortButton.Clicked += sortButton_Clicked;
            viewButton.Clicked += viewButton_Clicked;

            Content = new StackLayout
            {
                Children =
                {
                    new StackLayout {
                        Orientation = StackOrientation.Horizontal,
                        Children    =
                        {
                            sortButton,
                            viewButton
                        }
                    },
                    _list
                }
            };
        }
コード例 #12
0
        public ShedulePage()
        {
            Title   = "Расписание докторов";
            Doctors = new List <Doctor>
            {
                new Doctor {
                    Name = "Лебзак Марина Геннадьевна", TimeOfWork = "с 8-30 до 14-00 по четным ", TimeOfWorkSecond = "с 14-30  до 20-00 по нечетным", ImagePath = "lebzak.jpg", Speciality = "Стоматолог-терапевт"
                },
                new Doctor {
                    Name = "Гобрусева Лариса Анатольевна", TimeOfWork = "с 8-30 до 14-00 по нечетным", TimeOfWorkSecond = "с 14-30  до 20-00 по четным", ImagePath = "gobruseva.jpg", Speciality = "Стоматолог-терапевт"
                },
                new Doctor {
                    Name = "Никулин Андрей Петрович", TimeOfWork = "с 8-30 до 20-00", TimeOfWorkSecond = "", ImagePath = "nikulin.jpg", Speciality = "Стоматолог-ортопед"
                },
                new Doctor {
                    Name = "Горчаков Андрей Петрович", TimeOfWork = "с 8-30 до 14-00 по нечетным", TimeOfWorkSecond = "с 14-30  до 20-00 по четным", ImagePath = "gorchakov.jpg", Speciality = "Стоматолог-терапевт"
                },
                new Doctor {
                    Name = "Яблонская Елена Вячеславовна", TimeOfWork = " с 14-30 до 20-00 понедельник ", TimeOfWorkSecond = "с 8-30 до 14-00 четверг", ImagePath = "jablonskaya.jpg", Speciality = "Стоматолог-пародонтолог"
                },
                new Doctor {
                    Name = "Крестьян Светлана Юрьевна", TimeOfWork = "В декретном отпуске", TimeOfWorkSecond = "", ImagePath = "krestyan.jpg", Speciality = "Стоматолог"
                },
            };
            Label header = new Label
            {
                Text     = "Список врачей",
                FontSize = Device.GetNamedSize(NamedSize.Large, typeof(Label))
            };
            ListView listView = new ListView
            {
                HasUnevenRows = true,
                ItemsSource   = Doctors,
                                // Определяем формат отображения данных
                                ItemTemplate = new DataTemplate(() =>
                {
                    ImageCell imageCell = new ImageCell {
                        TextColor = Color.DarkBlue, DetailColor = Color.Green
                    };
                    imageCell.SetBinding(ImageCell.TextProperty, "Name");
                    Binding companyBinding = new Binding {
                        Path = "Speciality", StringFormat = "{0}"
                    };
                    imageCell.SetBinding(ImageCell.DetailProperty, companyBinding);
                    imageCell.SetBinding(ImageCell.ImageSourceProperty, "ImagePath");
                    return(imageCell);
                })
            };

            listView.ItemTapped += OnItemTapped;
            this.Content         = new StackLayout {
                Children = { header, listView }
            };
        }
コード例 #13
0
        public MenuPage()
        {
            var masterPageItems = new List <MasterPageItem> ();

            masterPageItems.Add(new MasterPageItem
            {
                Title      = StringService.Instance.MyResults,
                IconSource = "contacts.png",
                TargetType = typeof(AboutPage)
            });

            if (UserViewModel.Instance.User.Role != User.UserRole.Private)
            {
                masterPageItems.Add(new MasterPageItem
                {
                    Title      = UserViewModel.Instance.User.Role == User.UserRole.Teacher ? StringService.Instance.MyGroups : StringService.Instance.MyFeedbacks,
                    IconSource = "reminders.png",
                    TargetType = UserViewModel.Instance.User.Role == User.UserRole.Teacher ? typeof(GroupsListPage) : typeof(FeedbackOverviewPage)
                });
            }
            //	if (App.IsLoggedIn)
            masterPageItems.Add(new MasterPageItem {
                Title      = StringService.Instance.Logout,
                IconSource = "todo.png",
                TargetType = typeof(LoginPage)
            });
            listView = new ListView {
                ItemsSource  = masterPageItems,
                ItemTemplate = new DataTemplate(() => {
                    var imageCell = new ImageCell();
                    imageCell.SetBinding(TextCell.TextProperty, "Title");
                    imageCell.SetBinding(ImageCell.ImageSourceProperty, "IconSource");
                    imageCell.TextColor = Color.White;
                    return(imageCell);
                }),
                VerticalOptions     = LayoutOptions.FillAndExpand,
                SeparatorVisibility = SeparatorVisibility.None,
                BackgroundColor     = Color.Green
            };

            Padding = new Thickness(0, 40, 0, 0);
            Icon    = "hamburger.png";
            Title   = StringService.Instance.Menu;
            Content = new StackLayout {
                VerticalOptions = LayoutOptions.FillAndExpand,
                Children        =
                {
                    listView
                }
            };
            BackgroundColor = Color.Green;
        }
コード例 #14
0
        public SideMasterPage()
        {
            //			BackgroundColor = MyColors.WetAsphalt;
            BackgroundColor = MyColors.PurpleBrown;

            var masterPageItems = new List <SideMasterPageItem> ();

            masterPageItems.Add(new SideMasterPageItem {
                Title      = "Prayer Requests",
                IconSource = "contacts.png",
                TargetType = typeof(MyTabbedPage)
            });

            masterPageItems.Add(new SideMasterPageItem {
                Title      = "Settings",
                IconSource = "todo.png",
                TargetType = typeof(TodoListPage)
            });

            masterPageItems.Add(new SideMasterPageItem {
                Title      = "Profile",
                IconSource = "todo.png",
                TargetType = typeof(ProfilePage)
            });

            listView = new ListView {
                BackgroundColor = MyColors.PurpleBrown,
//				BackgroundColor = MyColors.WetAsphalt,

                ItemsSource  = masterPageItems,
                ItemTemplate = new DataTemplate(() => {
                    var imageCell = new ImageCell();
                    imageCell.SetBinding(TextCell.TextProperty, "Title");
                    imageCell.SetBinding(ImageCell.ImageSourceProperty, "IconSource");
                    return(imageCell);
                }),
                VerticalOptions     = LayoutOptions.FillAndExpand,
                SeparatorVisibility = SeparatorVisibility.None
            };

            Padding = new Thickness(0, 40, 0, 0);
            Icon    = "hamburger.png";
            Title   = "Personal Organiser";
            Content = new StackLayout {
                VerticalOptions = LayoutOptions.FillAndExpand,
                Children        =
                {
                    listView
                }
            };
        }
コード例 #15
0
        public MasterPageCS()
        {
            var masterPageItems = new List <MasterPageItem>();

            masterPageItems.Add(new MasterPageItem
            {
                Title      = "Välkommen",
                IconSource = "contacts.png",
                TargetType = typeof(ContactsPage)
            });
            masterPageItems.Add(new MasterPageItem
            {
                Title      = "Karta",
                IconSource = "todo.png",
                TargetType = typeof(TodoListPage)
            });
            masterPageItems.Add(new MasterPageItem
            {
                Title      = "Scanna QR-kod",
                IconSource = "reminders.png",
                TargetType = typeof(ReminderPage)
            });

            listView = new ListView
            {
                ItemsSource  = masterPageItems,
                ItemTemplate = new DataTemplate(() =>
                {
                    var imageCell = new ImageCell();
                    imageCell.SetBinding(TextCell.TextProperty, "Title");
                    imageCell.SetBinding(ImageCell.ImageSourceProperty, "IconSource");
                    return(imageCell);
                }),
                VerticalOptions     = LayoutOptions.FillAndExpand,
                SeparatorVisibility = SeparatorVisibility.None,
                RowHeight           = 50
            };

            Padding = new Thickness(0, 40, 0, 0);
            Icon    = "hamburger.png";
            Title   = "Polcirkelleden";
            Content = new StackLayout
            {
                VerticalOptions = LayoutOptions.FillAndExpand,
                Children        =
                {
                    listView
                }
            };
        }
コード例 #16
0
ファイル: Page3.cs プロジェクト: RedMark99/XamarinShopCandy
        public Page3()
        {
            Title           = "Корзина";
            IconImageSource = "Basket.png";
            //BackgroundColor = Color.FromHex("1E1E1E");

            using (var reader = new StringReader("^contentpage { background-color: RGB(30,30,30); }"))
            {
                this.Resources.Add(StyleSheet.FromReader(reader));
            }



            tempBasket = new List <Test>()
            {
            };
            tempBasket = Save.list;



            listView = new ListView
            {
                HasUnevenRows = true,
                ItemsSource   = Save.list,

                ItemTemplate = new DataTemplate(() =>// Определяем формат отображения данных
                {
                    ImageCell imageCell = new ImageCell {
                        TextColor = Color.Red, DetailColor = Color.Green
                    };
                    imageCell.SetBinding(ImageCell.TextProperty, "Name");
                    Binding companyBinding = new Binding {
                        Path = "Price", StringFormat = "Цена: {0}"
                    };
                    imageCell.SetBinding(ImageCell.DetailProperty, companyBinding);
                    imageCell.SetBinding(ImageCell.ImageSourceProperty, "ImagePath");
                    return(imageCell);
                })
            };


            listView.ItemTapped += OnListViewItemTapped;

            StackLayout stackLayout = new StackLayout()
            {
                Children = { listView }
            };

            this.Content = stackLayout;
        }
コード例 #17
0
ファイル: MasterPageCS.cs プロジェクト: lfsantle/Pedidos
        public MasterPageCS()
        {
            var masterPageItems = new List <MasterPageItem>();

            masterPageItems.Add(new MasterPageItem
            {
                Title      = "Pedidos",
                IconSource = "pedidos.png",
                TargetType = typeof(PedidosPage)
            });
            masterPageItems.Add(new MasterPageItem
            {
                Title      = "Clientes",
                IconSource = "clientes.png",
                TargetType = typeof(ClientesPage)
            });
            masterPageItems.Add(new MasterPageItem
            {
                Title      = "Sobre nós",
                IconSource = "sobre.png",
                TargetType = typeof(SobreNosPage)
            });


            listView = new ListView
            {
                ItemsSource  = masterPageItems,
                ItemTemplate = new DataTemplate(() =>
                {
                    var imageCell = new ImageCell();
                    imageCell.SetBinding(TextCell.TextProperty, "Title");
                    imageCell.SetBinding(ImageCell.ImageSourceProperty, "IconSource");
                    return(imageCell);
                }),
                VerticalOptions     = LayoutOptions.FillAndExpand,
                SeparatorVisibility = SeparatorVisibility.None
            };

            Padding = new Thickness(0, 40, 0, 0);
            Icon    = "hamburger.png";
            Title   = "Personal Organiser";
            Content = new StackLayout
            {
                VerticalOptions = LayoutOptions.FillAndExpand,
                Children        =
                {
                    listView
                }
            };
        }
コード例 #18
0
        public MasterPageViewModel()
        {
            var masterPageItems = new List <MasterPageItem>();

            masterPageItems.Add(new MasterPageItem
            {
                Title      = "Chercher partenaire",
                IconSource = " ",
                TargetType = typeof(SearchPartnerPageViewModel)
            });
            masterPageItems.Add(new MasterPageItem
            {
                Title      = "s'inscrire",
                IconSource = " ",
                TargetType = typeof(InscriptionPageViewModel)
            });
            masterPageItems.Add(new MasterPageItem
            {
                Title      = "A propos de HDF",
                IconSource = " ",
                TargetType = typeof(AboutPageViewModel)
            });

            listView = new ListView
            {
                ItemsSource  = masterPageItems,
                ItemTemplate = new DataTemplate(() =>
                {
                    var imageCell = new ImageCell();
                    imageCell.SetBinding(TextCell.TextProperty, "Title");
                    imageCell.SetBinding(ImageCell.ImageSourceProperty, "IconSource");
                    return(imageCell);
                }),
                VerticalOptions     = LayoutOptions.FillAndExpand,
                SeparatorVisibility = SeparatorVisibility.None
            };

            Padding = new Thickness(0, 40, 0, 0);
            Icon    = "hamburger.png";
            Title   = "Personal Organiser";
            Content = new StackLayout
            {
                VerticalOptions = LayoutOptions.FillAndExpand,
                Children        =
                {
                    listView
                }
            };
        }
コード例 #19
0
        public InviteToAppPage(ViewModelBase viewModel) : base(viewModel)
        {
            Title = "Contacts";

            var contactsCountLabel = new Label();

            contactsCountLabel.SetBinding(Label.TextProperty, new Binding("Contacts.Count", stringFormat: "{0} contacts."));

            var tipLabel = new Label();

            tipLabel.Text = "Select a contact to send an invitation";

            var listView = new BindableListView
            {
                ItemTemplate = new DataTemplate(() =>
                {
                    var imageCell = new ImageCell
                    {
                        ImageSource = Device.OnPlatform(
                            ImageSource.FromFile("empty_contact.jpg"),
                            ImageSource.FromFile("empty_contact.jpg"),
                            ImageSource.FromFile("Assets/empty_contact.jpg")),
                    };
                    imageCell.SetBinding(TextCell.TextProperty, new Binding("Name"));
                    imageCell.SetBinding(TextCell.DetailProperty, new Binding("Number"));
                    return(imageCell);
                }),
                IsGroupingEnabled   = true,
                GroupDisplayBinding = new Binding("Name"),
            };

            listView.SetBinding(ListView.ItemsSourceProperty, new Binding("GroupedContacts"));
            listView.SetBinding(BindableListView.ItemClickedCommandProperty, new Binding("ContactSelectedCommand"));

            var contactsLoadingIndicator = new ActivityIndicator();

            contactsLoadingIndicator.SetBinding(ActivityIndicator.IsRunningProperty, new Binding("IsBusy"));

            Content = new StackLayout
            {
                Children =
                {
                    contactsLoadingIndicator,
                    contactsCountLabel,
                    tipLabel,
                    listView
                }
            };
        }
コード例 #20
0
ファイル: ProjectListPage.cs プロジェクト: yongchaowu/samples
        public ProjectListPage()
        {
            this.Title = "Projects";

            var listView = new ListView
            {
                ItemsSource = this.items,

                ItemTemplate = new DataTemplate(() =>
                {
                    var cell = new ImageCell();
                    cell.SetBinding <ProjectVM>(TextCell.TextProperty, _ => _.Name);
                    cell.SetBinding <ProjectVM>(TextCell.DetailProperty, _ => _.Description);
                    cell.SetBinding <ProjectVM>(ImageCell.ImageSourceProperty, _ => _.ImageSource);

                    cell.Tapped += async delegate
                    {
                        var project = (ProjectVM)cell.BindingContext;
                        await this.Navigation.PushAsync(new ProjectPage(await AppState.Instance.Client.GetProjectClientAsync(project.Entity), project.Entity));
                    };

                    return(cell);
                }),
                IsPullToRefreshEnabled = true,
            };

            listView.RefreshCommand = new Command(
                async() =>
            {
                try
                {
                    await this.RefreshAsync();
                }
                finally
                {
                    listView.IsRefreshing = false;
                }
            });
            this.Content = listView;

            MessagingCenter.Subscribe <AppState>(this, AppState.UserChangedMessageId, async(sender) =>
            {
                this.items.Clear();
                await this.RefreshAsync();
            });
        }
コード例 #21
0
        View CreateContent(ImageCell cell)
        {
            XForm.Label text = new XForm.Label
            {
                HorizontalTextAlignment = TextAlignment.Start,
                VerticalTextAlignment   = TextAlignment.Start,
                HorizontalOptions       = LayoutOptions.FillAndExpand,
                VerticalOptions         = LayoutOptions.FillAndExpand,
                FontAttributes          = FontAttributes.Bold,
            };
            XForm.Label detailLabel = new XForm.Label
            {
                HorizontalTextAlignment = TextAlignment.Start,
                VerticalTextAlignment   = TextAlignment.Start,
                HorizontalOptions       = LayoutOptions.FillAndExpand,
                VerticalOptions         = LayoutOptions.FillAndExpand,
            };
            detailLabel.FontSize = Device.GetNamedSize(NamedSize.Micro, detailLabel);

            text.SetBinding(XForm.Label.TextProperty, new Binding("Text", source: cell));
            text.SetBinding(XForm.Label.TextColorProperty, new Binding("TextColor", source: cell));

            detailLabel.SetBinding(XForm.Label.TextProperty, new Binding("Detail", source: cell));
            detailLabel.SetBinding(XForm.Label.TextColorProperty, new Binding("DetailColor", source: cell));

            XForm.Image image = new XForm.Image
            {
                HeightRequest     = Element.ItemHeight,
                WidthRequest      = Element.ItemWidth,
                HorizontalOptions = LayoutOptions.FillAndExpand,
                VerticalOptions   = LayoutOptions.FillAndExpand,
                Aspect            = Aspect.Fill
            };
            image.SetBinding(XForm.Image.SourceProperty, new Binding("ImageSource", source: cell));

            var view = new AbsoluteLayout();

            view.Children.Add(image, new XForm.Rectangle(0, 0, 1, 1), AbsoluteLayoutFlags.All);
            view.Children.Add(new StackLayout
            {
                VerticalOptions   = LayoutOptions.EndAndExpand,
                HorizontalOptions = LayoutOptions.FillAndExpand,
                Children          =
                {
                    new StackLayout {
                        VerticalOptions   = LayoutOptions.EndAndExpand,
                        HorizontalOptions = LayoutOptions.FillAndExpand,
                        Padding           = 15,
                        Spacing           = 0,
                        BackgroundColor   = XForm.Color.FromHex("#2b7c87"),
                        Children          = { text, detailLabel }
                    }
                }
            }, new XForm.Rectangle(0, 0, 1, 1), AbsoluteLayoutFlags.All);

            cell.SetBinding(GridView.BindingContextProperty, new Binding("BindingContext", source: view));
            return(view);
        }
コード例 #22
0
        public ProjectFilesPage(IProjectClient client, string rootFolderId)
        {
            this.client       = client;
            this.rootFolderId = rootFolderId;

            this.Title = "Files";

            this.RefreshAsync();

            var listView = new ListView
            {
                ItemsSource = this.items,

                ItemTemplate = new DataTemplate(() =>
                {
                    var cell = new ImageCell();
                    cell.SetBinding <NodeVM>(TextCell.TextProperty, _ => _.Name);
                    cell.SetBinding <NodeVM>(TextCell.DetailProperty, _ => _.Details);
                    cell.SetBinding <NodeVM>(ImageCell.ImageSourceProperty, _ => _.ImageSource);

                    cell.Tapped += async delegate
                    {
                        var node = (NodeVM)cell.BindingContext;
                        await this.Navigation.PushAsync(new FilePage(client, node.Item));
                    };

                    return(cell);
                }),
                IsPullToRefreshEnabled = true,
            };

            listView.RefreshCommand = new Command(async() =>
            {
                try
                {
                    await this.RefreshAsync();
                }
                finally
                {
                    listView.IsRefreshing = false;
                }
            });
            this.Content = listView;
        }
            public ListViewContextActionsPage()
            {
                Title = "ListView & Context Actions";

                Content = new ScrollView
                {
                    Content = new StackLayout
                    {
                        Padding  = 20,
                        Spacing  = 10,
                        Children =
                        {
                            new Label
                            {
                                Text          = "Select the item source from the picker and then view the context menu of each item.",
                                LineBreakMode = LineBreakMode.WordWrap,
                            },
                            CreateImageSourcePicker("Select Icon Source", getter =>
                            {
                                _listView.ItemsSource = null;
                                _listView.ItemsSource = CreateDataItems(getter);
                            }),
                            (_listView = new ListView
                            {
                                Margin = new Thickness(-20, 0, -20, -20),
                                ItemsSource = CreateDataItems(),
                                ItemTemplate = new DataTemplate(() =>
                                {
                                    var menuItem = new MenuItem();
                                    menuItem.SetBinding(MenuItem.TextProperty, new Binding(nameof(ListItem.Text)));
                                    menuItem.SetBinding(MenuItem.IconImageSourceProperty, new Binding(nameof(ListItem.ContextImage)));

                                    var cell = new ImageCell();
                                    cell.ContextActions.Add(menuItem);
                                    cell.SetBinding(ImageCell.TextProperty, new Binding(nameof(ListItem.Text)));
                                    cell.SetBinding(ImageCell.ImageSourceProperty, new Binding(nameof(ListItem.Image)));

                                    return(cell);
                                }),
                            })
                        }
                    }
                };
            }
コード例 #24
0
ファイル: Page3.cs プロジェクト: RedMark99/XamarinShopCandy
        async void updateApp()
        {
            tempBasket = Save.list;

            var groups = tempBasket.GroupBy(p => p.Type).Select(g => new Grouping <string, Test>(g.Key, g));

            TestGroups          = new ObservableCollection <Grouping <string, Test> >(groups);
            this.BindingContext = this;


            listView.SeparatorColor = Color.Black;

            listView = new ListView
            {
                HasUnevenRows       = true,
                ItemsSource         = TestGroups,
                IsGroupingEnabled   = true,
                GroupDisplayBinding = new Binding("Type"),

                ItemTemplate = new DataTemplate(() =>// Определяем формат отображения данных
                {
                    ImageCell imageCell = new ImageCell {
                        TextColor = Color.White, DetailColor = Color.Green
                    };
                    imageCell.SetBinding(ImageCell.TextProperty, "Name");
                    Binding companyBinding = new Binding {
                        Path = "Price", StringFormat = "Цена: {0} руб"
                    };
                    imageCell.SetBinding(ImageCell.DetailProperty, companyBinding);
                    imageCell.SetBinding(ImageCell.ImageSourceProperty, "ImagePath");
                    return(imageCell);
                })
            };

            listView.ItemTapped += OnListViewItemTapped;

            StackLayout stackLayout = new StackLayout()
            {
                Children = { listView }
            };

            this.Content = stackLayout;
        }
コード例 #25
0
        public OnlineUsersPage(ViewModelBase viewModel) : base(viewModel)
        {
            Title = "Participants";
            Icon  = "group.png";

            var usersCountLabel = new Label();

            usersCountLabel.SetBinding(Label.TextProperty, new Binding("Users.Count", stringFormat: "  {0} users online."));

            var listView = new BindableListView
            {
                ItemTemplate = new DataTemplate(() =>
                {
                    var imageCell = new ImageCell
                    {
                        ImageSource = Device.OnPlatform(
                            ImageSource.FromFile("empty_contact.jpg"),
                            ImageSource.FromFile("empty_contact.jpg"),
                            ImageSource.FromFile("Assets/empty_contact.jpg")),
                    };
                    imageCell.SetBinding(TextCell.TextProperty, new Binding("Name"));
                    imageCell.SetBinding(TextCell.DetailProperty, new Binding("Description"));
                    return(imageCell);
                })
            };

            listView.SetBinding(ListView.ItemsSourceProperty, new Binding("Users"));
            listView.SetBinding(BindableListView.ItemClickedCommandProperty, new Binding("ContactSelectedCommand"));

            var contactsLoadingIndicator = new ActivityIndicator();

            contactsLoadingIndicator.SetBinding(ActivityIndicator.IsRunningProperty, new Binding("IsBusy"));

            Content = new StackLayout
            {
                Children =
                {
                    contactsLoadingIndicator,
                    usersCountLabel,
                    listView
                }
            };
        }
コード例 #26
0
        public ProjectListPage(ITrimbleConnectClient client)
        {
            this.client = client;

            this.Title = "Projects";

            this.RefreshAsync();

            var listView = new ListView
            {
                ItemsSource = this.items,

                ItemTemplate = new DataTemplate(() =>
                {
                    var cell = new ImageCell();
                    cell.SetBinding <ProjectVM>(TextCell.TextProperty, _ => _.Name);
                    cell.SetBinding <ProjectVM>(TextCell.DetailProperty, _ => _.Description);
                    cell.SetBinding <ProjectVM>(ImageCell.ImageSourceProperty, _ => _.ImageSource);

                    cell.Tapped += async delegate
                    {
                        var project = (ProjectVM)cell.BindingContext;
                        await this.Navigation.PushAsync(new ProjectPage(await this.client.GetProjectClientAsync(project.Entity), project.Entity));
                    };

                    return(cell);
                }),
                IsPullToRefreshEnabled = true,
            };

            listView.RefreshCommand = new Command(async() =>
            {
                try
                {
                    await this.RefreshAsync();
                }
                finally
                {
                    listView.IsRefreshing = false;
                }
            });
            this.Content = listView;
        }
コード例 #27
0
        public ReliefPage()
        {
            InitializeComponent();
            StackLayout stackLayout = new StackLayout();

            stackLayout.BackgroundColor = Color.Black;
            Relief = new List <Relief1>
            {
                new Relief1 {
                    Title = "Жим штанги лежа", Title1 = "\nКоличество повторений: 8-12 \nКоличество подходов: 3-4"
                },
                new Relief1 {
                    Title = "Жим гантелей лежа", Title1 = "\nНеделя 1: 3*10–12\n Неделя 2: 4*8–10 "
                },
                new Relief1 {
                    Title = "Сведение рук в тренажере", Title1 = "\nКоличество повторений: 15-20  \nКоличество подходов: 3"
                },
                new Relief1 {
                    Title = "Подъем штанги на бицепс", Title1 = "\nКоличество повторений: 8-12\nКоличество подходов: 3-4"
                },
                new Relief1 {
                    Title = "Подъем гантелей на бицепс сидя", Title1 = "\nКоличество повторений: 15-20\n Количество подходов: 3"
                },
                new Relief1 {
                    Title = "Легкий бег", Title1 = "\nПродолжительность: 20 минут\n Интенсивность: Легкая"
                }
            };
            bt1 = new Button {
                Text = "Назад", BackgroundColor = Color.Blue, BorderWidth = 2, BorderColor = Color.White, TextColor = Color.White, CornerRadius = 60
            };
            bt1.Clicked += Bt1_Clicked;


            ListView listView = new ListView
            {
                HasUnevenRows = true,
                ItemsSource   = Relief,
                // Определяем формат отображения данных
                ItemTemplate = new DataTemplate(() =>
                {
                    ImageCell imageCell = new ImageCell {
                        TextColor = Color.White, DetailColor = Color.White
                    };
                    imageCell.SetBinding(ImageCell.TextProperty, "Title");

                    return(imageCell);
                })
            };

            listView.ItemTapped += ListView_ItemTapped;
            stackLayout.Children.Add(bt1);
            stackLayout.Children.Add(listView);

            this.Content = stackLayout;
        }
コード例 #28
0
        public MasterPage()
        {
            var masterPageItems = new List <MasterPageItem>();

            masterPageItems.Add(new MasterPageItem
            {
                Title      = "Form 1",
                IconSource = "contacts.png",
                FormSource = "form1"
            });
            masterPageItems.Add(new MasterPageItem
            {
                Title      = "Form 2",
                IconSource = "todo.png",
                FormSource = "form2"
            });
            masterPageItems.Add(new MasterPageItem
            {
                Title      = "Form 3",
                IconSource = "reminders.png",
                FormSource = "form3"
            });

            listView = new ListView
            {
                ItemsSource  = masterPageItems,
                ItemTemplate = new DataTemplate(() =>
                {
                    var imageCell = new ImageCell();
                    imageCell.SetBinding(TextCell.TextProperty, "Title");
                    //imageCell.set(ImageCell.ImageSourceProperty, "IconSource");
                    return(imageCell);
                }),
                VerticalOptions     = LayoutOptions.FillAndExpand,
                SeparatorVisibility = SeparatorVisibility.None
            };

            ViewAllSubmissions = new Button
            {
                Text = "View Submissions",
                HorizontalOptions = LayoutOptions.Center
            };

            Padding = new Thickness(0, 40, 0, 0);
            Icon    = "hamburger.png";
            Title   = "Forms";
            Content = new StackLayout
            {
                VerticalOptions = LayoutOptions.FillAndExpand,
                Children        =
                {
                    listView            //,ViewAllSubmissions
                }
            };
        }
コード例 #29
0
        public FileHistoryPage(IProjectClient client, FolderItem item)
        {
            this.client = client;
            this.item   = item;

            this.Title = "History";

            this.RefreshAsync();

            var listView = new ListView
            {
                ItemsSource = items,

                ItemTemplate = new DataTemplate(() =>
                {
                    var cell = new ImageCell();
                    cell.SetBinding <NodeVM>(TextCell.TextProperty, _ => _.Name);
                    cell.SetBinding <NodeVM>(TextCell.DetailProperty, _ => _.Details);
                    cell.SetBinding <NodeVM>(ImageCell.ImageSourceProperty, _ => _.ImageSource);
                    return(cell);
                }),
                IsPullToRefreshEnabled = true,
            };

            listView.RefreshCommand = new Command(async() =>
            {
                try
                {
                    await this.RefreshAsync();
                }
                finally
                {
                    listView.IsRefreshing = false;
                }
            });
            this.Content = listView;
        }
コード例 #30
0
        public ListViewImageCell()
        {
            Content = new ListView()
            {
                ItemTemplate = new DataTemplate(() =>
                {
                    var cell = new ImageCell();
                    cell.SetBinding(ImageCell.ImageSourceProperty, ".");
                    return(cell);
                }),

                ItemsSource = Enumerable.Range(0, 100)
                              .Select(i => (i % 2 == 0) ? "coffee.png" : "vegetables.jpg")
                              .ToList()
            };
        }