public CodedPage () { _SomeLabel = new Label { XAlign = TextAlignment.Center, }; _SomeLabel.SetBinding (Label.TextProperty, nameof (SomeViewModel.SomeLabel)); var listViewItemTemplate = new DataTemplate (typeof(ImageCell)); _ItemsListView = new ListView (ListViewCachingStrategy.RecycleElement) { ItemTemplate = listViewItemTemplate, }; _ItemsListView.SetBinding (ListView.ItemsSourceProperty, nameof (SomeViewModel.SomeItems)); listViewItemTemplate.SetBinding (ImageCell.TextProperty, nameof (SomeItem.ItemName)); listViewItemTemplate.SetBinding (ImageCell.ImageSourceProperty, nameof (SomeItem.ImageUrl)); _ItemsListView.ItemTapped += async (sender, e) => { var item = ((SomeItem)e.Item); ItemSelected (this, item); _ItemsListView.SelectedItem = null; }; Padding = new Thickness (0, 20, 0, 0); Content = new StackLayout { VerticalOptions = LayoutOptions.Fill, HorizontalOptions = LayoutOptions.Fill, Children = { _SomeLabel, _ItemsListView, } }; }
private async Task Init () { _conferencesListView = new ListView { HorizontalOptions = LayoutOptions.FillAndExpand, VerticalOptions = LayoutOptions.FillAndExpand, }; var cell = new DataTemplate (typeof(TextCell)); cell.SetBinding (TextCell.TextProperty, "Name"); cell.SetBinding (TextCell.DetailProperty, new Binding (path: "Start", stringFormat: "{0:MM/dd/yyyy}")); _conferencesListView.ItemTemplate = cell; var viewModel = new ConferencesViewModel (); await viewModel.GetConferences (); _conferencesListView.ItemsSource = viewModel.Conferences; this.Content = new StackLayout { VerticalOptions = LayoutOptions.FillAndExpand, Padding = new Thickness ( left: 0, right: 0, bottom: 0, top: Device.OnPlatform (iOS: 20, Android: 0, WinPhone: 0)), Children = { _conferencesListView } }; }
///<summary>FcpChampions: Displays a listview of all champions. ///<para>[Navigation] From: MainPage / Calls: FcpTabChampions</para> ///</summary> public FcpChampions() { //NavigationPage.SetBackButtonTitle(this, "Back to menu"); this.Title = "Champions"; stacklayout.VerticalOptions = LayoutOptions.FillAndExpand; stacklayout.BackgroundColor = Color.Red ; //ReadChampionJson(); //ReceiveChampions(); FillViewChampions(); var cell = new DataTemplate(typeof(ImageCell)); cell.SetBinding(ImageCell.ImageSourceProperty, "Image"); cell.SetBinding(TextCell.TextProperty, "Name"); cell.SetBinding(TextCell.TextColorProperty, "Color"); listview.ItemTemplate = cell; listview.ItemsSource = Cells; listview.ItemTapped += Listview_ItemTapped; listview.BackgroundColor = Color.Black; searchbar.Placeholder = "Find champion"; searchbar.TextChanged += Searchbar_TextChanged; searchbar.BackgroundColor = Color.Black; Content = stacklayout; stacklayout.Children.Add(searchbar); stacklayout.Children.Add(listview); }
public ContactsPage() { contactsList = new ListView(); var cell = new DataTemplate(typeof(TextCell)); cell.SetBinding(TextCell.TextProperty, "FirstName"); cell.SetBinding(TextCell.DetailProperty, "LastName"); contactsList.ItemTemplate = cell; contactsList.ItemSelected += (sender, args) => { if (contactsList.SelectedItem == null) return; var contact = contactsList.SelectedItem as Contact; Navigation.PushAsync(new ContactPage(contact)); contactsList.SelectedItem = null; }; Content = contactsList; }
public RssFeedView2() { this.viewModel = new RssFeedViewModel(); this.BindingContext = viewModel; this.Title = "Rss Feed"; var refresh = new ToolbarItem(){ Command = viewModel.ReloadCommand, Name = "Reload", Priority = 0 }; ToolbarItems.Add(refresh); var stack = new StackLayout(){ Orientation = StackOrientation.Vertical }; var activity = new ActivityIndicator(){ Color = Color.Blue, IsEnabled = true }; activity.SetBinding(ActivityIndicator.IsVisibleProperty, "ShowActivityIndicator"); activity.SetBinding(ActivityIndicator.IsRunningProperty, "ShowActivityIndicator"); stack.Children.Add(activity); var listview = new ListView(); listview.ItemsSource = viewModel.Records; var cell = new DataTemplate(typeof(ImageCell)); cell.SetBinding(ImageCell.TextProperty, "Title"); cell.SetBinding(ImageCell.ImageSourceProperty, "Image"); listview.ItemTemplate = cell; listview.ItemSelected += async (sender, e) => { await Navigation.PushAsync(new RssWebView((RssRecordViewModel)e.SelectedItem)); listview.SelectedItem = null; }; stack.Children.Add(listview); Content = stack; }
public FoodCategoryPage () { Title = "Food"; Padding = new Thickness (10, 20); var places = new List<Place> () { new Place("McDonalds", "mcdonalds.png", "1010 S McKenzie St Foley, AL"), new Place("Burger King", "burgerKing.png", "910 S McKenzie St Foley AL"), new Place("Apple Bees", "appleBees.png", "2409 S McKenzie St, Foley, AL"), new Place("Taco Bell", "tacoBell.jpg", "1165 S McKenzie St, Foley, AL"), new Place("Subway", "subway.jpg", "610 S McKenzie St Foley, AL") }; var imageTemplate = new DataTemplate (typeof(ImageCell)); imageTemplate.SetBinding (ImageCell.TextProperty, "Name"); imageTemplate.SetBinding (ImageCell.ImageSourceProperty, "Icon"); imageTemplate.SetBinding (ImageCell.DetailProperty, "Address"); var listView = new ListView () { ItemsSource = places, ItemTemplate = imageTemplate }; Content = listView; }
private void SetupUI() { BackgroundColor = Color.White; var cell = new DataTemplate (typeof(HiveListCell)); cell.SetBinding (HiveListCell.HeadingTextProperty, "DisplayName"); cell.SetBinding (HiveListCell.MiddleTextProperty, "ReadDate"); cell.SetBinding (HiveListCell.LowerTextProperty, "Humidity"); // cell.SetBinding (HiveListCell.BottomTextProperty, "Humidity"); //cell.SetBinding (HiveListCell.BottomUUIDProperty, "DisplayUUIDName"); //cell.SetBinding (HiveListCell.HiveAddressProperty, "Address"); listOfReadings = new ListView (ListViewCachingStrategy.RetainElement); listOfReadings.HasUnevenRows = true; listOfReadings.BindingContext = ListReadings; listOfReadings.SetBinding (ListView.ItemsSourceProperty, "."); listOfReadings.ItemTemplate = cell; listOfReadings.BackgroundColor = Color.White; Content = new StackLayout { Children = { listOfReadings }, Padding = new Thickness (0, 0, 0, 1) }; }
public KnockoutMatchView() { BindingContext = new KnockoutMatchesViewModel(); var refresh = new ToolbarItem { Command = ViewModel.LoadItemsCommand, Icon = "refresh.png", Name = "refresh", Priority = 0 }; ToolbarItems.Add (refresh); var stack = new StackLayout { Orientation = StackOrientation.Vertical, Padding = new Thickness(0, 8, 0, 8) }; var listView = new ListView (); listView.ItemsSource = ViewModel.KnockoutMatches; var cell = new DataTemplate(typeof(ListTextCell)); cell.SetBinding (TextCell.TextProperty, "KnockoutMatchName"); cell.SetBinding (TextCell.DetailProperty, "KnockoutMatchTeams"); listView.ItemTemplate = cell; stack.Children.Add (listView); Content = stack; }
public void Init() { if (Device.OS == TargetPlatform.iOS) { var list = new EditableListView<Object> (); list.SetBinding (EditableListView<Object>.SourceProperty, "JellyBeanValues"); list.ViewType = typeof(JellyBeanListViewCell); list.CellHeight = 60; list.AddRowCommand = new Command (() => { this.DisplayAlert ("Sorry", "Not implemented yet!", "OK"); }); if (PageModel.JellyBeanValues != null) list.Source = PageModel.JellyBeanValues; Content = list; } else { var list = new ListView(); list.SetBinding (ListView.ItemsSourceProperty, "JellyBeanValues"); var celltemp = new DataTemplate(typeof(TextCell)); celltemp.SetBinding (TextCell.TextProperty, "Name"); celltemp.SetBinding (TextCell.DetailProperty, "ReadableValues"); list.ItemTemplate = celltemp; if (PageModel.JellyBeanValues != null) list.ItemsSource = PageModel.JellyBeanValues; Content = list; } ToolbarItems.Add(new ToolbarItem("Add", "", () => { this.DisplayAlert("Sorry", "Not implemented yet!", "OK"); })); }
public ListaNotificaciones() { //notificaciones = new Notificacion ("Red Social","BtoB"); var cell = new DataTemplate (typeof(TextCell)); cell.SetBinding (TextCell.TextProperty, "Title"); cell.SetBinding (TextCell.DetailProperty, "Subtitle"); ItemTemplate = cell; var loc = new List<Notificacion> () { new Notificacion ("Abercrombie & Fitch / abercrombie kids", "Level 2 | (480) 792-9275"), new Notificacion ("ALDO", "Level 2 | (480) 899-0803"), new Notificacion ("All Mobile Matters Mobile Phone Repair & More", "Level 2 | (480) 228-9690"), new Notificacion ("Alterations By L", "Level 1 | (480) 786-8092"), new Notificacion ("AMERICAN EAGLE OUTFITTERS", "Level 2 | (480) 812-0090"), new Notificacion ("Ann Taylor", "Level 1 | (480) 726-6944"), new Notificacion ("Apex by sunglass hut", "Level 2 | (480) 855-1709") }; ItemsSource = loc; /*ItemSelected += (s, e) => { if (SelectedItem == null) return; var selected = (Notificacion)e.SelectedItem; SelectedItem = null; //Navigation.PushAsync (new CampusLocationPage (selected)); };*/ }
public FeedOverview() { var refreshButton = new Button { HorizontalOptions = LayoutOptions.FillAndExpand, VerticalOptions = LayoutOptions.Center, Text = "Refresh" }; refreshButton.SetBinding(Button.CommandProperty, "RefreshCommand"); var template = new DataTemplate(typeof(TextCell)); // We can set data bindings to our supplied objects. template.SetBinding(TextCell.TextProperty, "Title"); template.SetBinding(TextCell.DetailProperty, "Description"); var listView = new ListView {ItemTemplate = template}; listView.SetBinding(ListView.ItemsSourceProperty, "FeedItems"); // Push the list view down below the status bar on iOS. Padding = new Thickness(10, Device.OnPlatform(20, 0, 0), 10, 5); Content = new Grid { BindingContext = new FeedReaderViewModel(), RowDefinitions = new RowDefinitionCollection { new RowDefinition { Height = new GridLength (1, GridUnitType.Star) }, new RowDefinition { Height = new GridLength (0, GridUnitType.Auto) }, }, Children = { new ViewWithGridPosition(listView, 0,0), new ViewWithGridPosition(refreshButton, 1,0) }, }; }
public SchoolPickerPage(LoginPage page) { InitializeComponent (); _Context = SynchronizationContext.Current; Search.TextChanged += (object sender, TextChangedEventArgs e) => { if ((DateTime.Now - _PreviousGet).TotalSeconds < 4 && Search.Text.Length > 3) { GetSchoolData(); _PreviousGet = DateTime.Now; } }; Search.SearchButtonPressed += (object sender, EventArgs e) => { GetSchoolData(); _PreviousGet = DateTime.Now; }; var SchoolTemplate = new DataTemplate (typeof(Xamarin.Forms.TextCell)); SchoolTemplate.SetBinding (TextCell.TextProperty, new Binding ("Name")); SchoolTemplate.SetBinding (TextCell.DetailProperty, new Binding ("Url")); Results.ItemTemplate = SchoolTemplate; Results.ItemTapped += (object sender, ItemTappedEventArgs e) => { page.SelectSchool((Magister.School)e.Item); Navigation.PopModalAsync(); }; }
public Offers () { //commented out dummy offers //setOffers (); Title = "Offers"; Icon = "Offers.png"; // Create a data template from the type ImageCell var cell = new DataTemplate (typeof(ImageCell)); cell.SetBinding (TextCell.TextProperty, "Name"); cell.SetBinding (TextCell.DetailProperty,"Description"); cell.SetBinding (ImageCell.ImageSourceProperty, "Image"); ListView listView = new ListView { ItemsSource = offers, ItemTemplate = cell // Set the ImageCell to the item template for the listview }; // Push the list view down below the status bar on iOS. this.Padding = new Thickness (10, Device.OnPlatform (20, 0, 0), 10, 5); // Set the content for the page. this.Content = new StackLayout { Children = { //header, listView } }; }
/// <summary> /// Menu Page Layout. /// </summary> public void MenuLayout() { List<MenuModel> data = MenuModel.MenuListData(); listMenu = new ListView { RowHeight = 40, SeparatorColor = Color.FromHex("#5B5A5F") }; listMenu.VerticalOptions = LayoutOptions.FillAndExpand; listMenu.BackgroundColor = Color.Transparent; listMenu.ItemsSource = data; var cell = new DataTemplate(typeof(MenuCell)); cell.SetBinding(MenuCell.TextProperty, "Title"); cell.SetBinding(MenuCell.ImageSourceProperty, "IconSource"); listMenu.ItemTemplate = cell; //var menuLabel = new ContentView //{ // Padding = new Thickness(10, 36, 0, 5), // Content = new Label // { // TextColor = Color.FromHex("AAAAAA"), // Text = "MENU", // } //}; this.Content = new StackLayout { BackgroundColor = Color.White, Children = { listMenu } }; }
public ListViewEx() { var classNames = new[] { "Building Cross Platform Apps with Xamarin Part1", "Building Cross Platform Apps with Xamarin Part2", "Building Cross Platform Apps with Xamarin Part3" }; //TODO: Translate into XAML Padding = new Thickness(0, Device.OnPlatform(20, 0, 0), 0, 0); var listView = new ListView(); //listView.ItemsSource = classNames; listView.ItemsSource = PluralsightCourse.GetCourseList(); var cell = new DataTemplate(typeof(TextCell)); //cell.SetBinding(TextCell.TextProperty, new Binding(".")); cell.SetBinding(TextCell.TextProperty, new Binding("Title")); cell.SetBinding(TextCell.DetailProperty, new Binding("Author")); cell.SetValue(TextCell.TextColorProperty, Color.Red); cell.SetValue(TextCell.DetailColorProperty,Color.Yellow); listView.ItemTemplate = cell; Content = listView; }
public ShoppingCategoryPage () { Title = "Shopping"; Padding = new Thickness (10, 20); var places = new List<Place> () { new Place("Walmart", "walmart.jpeg", "2200 S McKenzie St, Foley"), new Place("Tanger Outlet Center", "tanger.jpg", "2601 S McKenzie St, Ste 466, Foley, AL"), new Place("Radio Shack", "radioShack.jpg", "1190 S Mckensie, Foley, AL") }; var imageTemplate = new DataTemplate (typeof(ImageCell)); imageTemplate.SetBinding (ImageCell.TextProperty, "Name"); imageTemplate.SetBinding (ImageCell.ImageSourceProperty, "Icon"); imageTemplate.SetBinding (ImageCell.DetailProperty, "Address"); var listView = new ListView () { ItemsSource = places, ItemTemplate = imageTemplate }; Content = listView; }
public SportsCategoryPage () { Title = "Sports"; Padding = new Thickness (10, 20); var places = new List<Place> () { new Place("The Gulf Bowl", "gulfBowl.jpg", "2881 S Juniper St, Foley, AL"), new Place("Foley Sports Complex", "foleySportsComplex.jpg", "998 W Section Ave, Foley, AL"), new Place("Swatters Sports Complex", "swattersSportsComplex.jpg", "21431 Co Rd 12 S Foley, AL") }; var imageTemplate = new DataTemplate (typeof(ImageCell)); imageTemplate.SetBinding (ImageCell.TextProperty, "Name"); imageTemplate.SetBinding (ImageCell.ImageSourceProperty, "Icon"); imageTemplate.SetBinding (ImageCell.DetailProperty, "Address"); var listView = new ListView () { ItemsSource = places, ItemTemplate = imageTemplate }; Content = listView; }
public ProductPage (String uid) { Title = "Produits"; var dataTemplate = new DataTemplate (typeof(TextCell)); dataTemplate.SetBinding (TextCell.TextProperty, "name"); dataTemplate.SetBinding (TextCell.DetailProperty, "price"); list = new ListView (); list.ItemTemplate = dataTemplate; list.IsPullToRefreshEnabled = true; list.RefreshCommand = new Command (() => loadProductData()); list.ItemSelected += (object sender, SelectedItemChangedEventArgs e) => { if(e.SelectedItem == null) return; Product product = (Product)e.SelectedItem; list.SelectedItem = null; //TODO: implement nav to product detail page //this.Navigation.PushAsync (new ProductPage(category.uid)); }; Content = list; this.categoryUid = uid; list.BeginRefresh (); }
public ListViewPageCS() { AddListItem(n); // ListView のセルを定義します。 var cell = new DataTemplate(typeof(TextCell)); cell.SetBinding(TextCell.TextProperty, "TextItem"); cell.SetBinding(TextCell.DetailProperty, "DetailItem"); // ListView を定義します。 var list = new ListView { ItemsSource = listItems, ItemTemplate = cell, }; var indicator = new ActivityIndicator { IsRunning = true, }; stack = new StackLayout { IsVisible = false, Padding = 10, Children = { indicator, }, }; // ListView の各 Item が表示された時にイベントが発生します。 list.ItemAppearing += async (object sender, ItemVisibilityEventArgs e) => { #if DEBUG System.Diagnostics.Debug.WriteLine((e.Item as ListItem).TextItem); System.Diagnostics.Debug.WriteLine("LastData is " + listItems.Last().TextItem); #endif // ObservableCollection の最後が ListView の Item と一致した時に ObservableCollection にデータを追加するなどの処理を行ってください。 if (listItems.Last() == e.Item as ListItem) { stack.IsVisible = true; await Task.Delay(2000); n++; AddListItem(cellAmount * n); stack.IsVisible = false; } }; Padding = new Thickness(0, Device.OnPlatform(20, 0, 0), 0, 0); Content = new StackLayout { Children = { list, stack, }, }; }
private async Task Init() { _itemSelectedEventHandler = (sender, args) => { if (args.SelectedItem == null) return; var selectedItem = args.SelectedItem as ResourceListItemViewModel; Navigation.PushAsync(new ResourceViewPage(selectedItem)); }; BackgroundColor = Constants.HtBoxDarkBrown; Padding = new Thickness(0, Device.OnPlatform(20,0,0), 0, 0); Title = "Resources for: Big Disaster"; //TODO - Add Disaster Name // TODO: Get data from the API //ICrisisCheckInApiClient apiClient = new CrisisCheckInApiClient(); //var dtos = await apiClient.GetCommitmentsList(2); //TODO: wire up to Auth0 so we don't have to pass person ID //Data = dtos.Select(c => new DisasterListItemViewModel(c)); ResourceList = new List<ResourceListItemViewModel> { new ResourceListItemViewModel { Description = "Dump Truck", Type = "Heavy Machines", PersonFullName = "Bob Smith", Location_State = "Maine", Qty = 2 }, new ResourceListItemViewModel { Description = "Poland Spring Water", Type = "Water", PersonFullName = "Mike Smith", Location_State = "Maine", Qty = 500 } }; _resourceListView = new ListView { ItemsSource = ResourceList, BackgroundColor = Constants.HtBoxDarkBrown }; _resourceListView.ItemSelected += _itemSelectedEventHandler; var cell = new DataTemplate(typeof(TextCell)); cell.SetBinding(TextCell.TextProperty, new Binding("Type")); cell.SetBinding(TextCell.DetailProperty, new Binding("Description")); cell.SetValue(TextCell.TextColorProperty, Color.White); cell.SetValue(TextCell.DetailColorProperty, Constants.HtBoxLightBrown); _resourceListView.ItemTemplate = cell; Content = _resourceListView; }
public MonkeyListPage() { var spinner = new ActivityIndicator(); spinner.SetBinding(ActivityIndicator.IsRunningProperty, "IsBusy"); spinner.SetBinding(ActivityIndicator.IsVisibleProperty, "IsBusy"); spinner.Color = Color.Blue; var list = new ListView(); list.SetBinding(ListView.ItemsSourceProperty, "MonkeyList"); var cell = new DataTemplate(typeof(ImageCell)); cell.SetBinding(ImageCell.TextProperty, "Name"); cell.SetBinding(ImageCell.DetailProperty, "Location"); cell.SetBinding(ImageCell.ImageSourceProperty, "Image"); list.ItemTemplate = cell; //listView // --> ItemTemplate // ----> DataTemplate // -------> Cell var getMonkeys = new Button { Text = "Get Monkeys" }; getMonkeys.Clicked += async (sender, e) => { try { await _viewModel.GetMonkeysAsync(); } catch { DisplayAlert("Error", "No Monkeys Found :(", "OK"); } }; list.ItemTapped += async (sender, e) => { var detail = new MonkeyPage(); detail.BindingContext = e.Item; await Navigation.PushAsync(detail); list.SelectedItem = null; }; Content = new StackLayout { Children = { spinner, list, getMonkeys } }; BindingContext = _viewModel; }
public MatchListPage () { Title = "Match List"; busyIcon = new ActivityIndicator (); matchData = new ObservableCollection<RobotMatch> (); matchData.Add (new RobotMatch (1, null)); matchData.Add (new RobotMatch (2, null)); //This provides space between the iOS status bar and the rest of the page this.Padding = new Thickness(0, Device.OnPlatform(20, 0, 0), 0, 0); StackLayout stack = new StackLayout (); stack.Spacing = 5; listView = new ListView (); listView.ItemTapped += (sender, e) => { // do something with e.Item ((ListView)sender).SelectedItem = null; // de-select the row }; listView.ItemSelected += (sender, e) => { if (e.SelectedItem == null) { return; // don't do anything if we just de-selected the row } // do something with e.SelectedItem ParseObject ob = ((RobotMatch)e.SelectedItem).Data; Navigation.PushAsync (new InterfacePage (ob)); ((ListView)sender).SelectedItem = null; // de-select the row }; DataTemplate template = new DataTemplate (typeof (RobotsCell)); template.SetBinding (RobotsCell.TextProperty, "MatchName"); template.SetBinding (RobotsCell.DetailProperty, "CreatedDate"); //Dont need since SelectedItem == MatchData template.SetBinding (RobotsCell.CellParseDataProperty , "Data"); listView.ItemTemplate = template; Button addMatchBtn = new Button (); addMatchBtn.Text = "New Match"; addMatchBtn.TextColor = Color.White; addMatchBtn.BackgroundColor = Color.Fuschia; addMatchBtn.Clicked += (object sender, EventArgs e) => { busyIcon.IsVisible = true; busyIcon.IsRunning = true; AddNewMatch(); }; listView.ItemsSource = matchData; stack.Children.Add (busyIcon); stack.Children.Add (addMatchBtn); stack.Children.Add (listView); this.Content = stack; }
private DataTemplate CreateRequestCell() { var cell = new DataTemplate(typeof (TextCell)); cell.SetBinding(TextCell.TextProperty, new Binding("Description")); cell.SetBinding(TextCell.DetailProperty, new Binding("Location")); cell.SetValue(TextCell.TextColorProperty, Color.White); cell.SetValue(TextCell.DetailColorProperty, Constants.HtBoxLightBrown); return cell; }
public AbsolutePageCS() { AddListItem(n); var cell = new DataTemplate(typeof(TextCell)); cell.SetBinding(TextCell.TextProperty, "TextItem"); cell.SetBinding(TextCell.DetailProperty, "DetailItem"); listLayer = new ListView { ItemsSource = listItems, ItemTemplate = cell, }; listLayer.ItemAppearing += ListLayer_ItemAppearing; frameLayer = new Frame { //BackgroundColor = Color.Black.MultiplyAlpha(0.7d), BackgroundColor = Color.White, IsVisible = false, Content = new StackLayout { Children = { new ActivityIndicator { IsRunning = true, Color = Device.OnPlatform(Color.White, Color.Default, Color.Accent), }, new Label { Text = "Data loading...", TextColor = Color.Black, XAlign = TextAlignment.Center, }, } }, }; bgLayer = new ContentView { BackgroundColor = Color.Black.MultiplyAlpha(0.4d), IsVisible = false, }; var abs = new AbsoluteLayout(); abs.Children.Add(listLayer); abs.Children.Add(bgLayer); abs.Children.Add(frameLayer); this.Title = "AbsoluteIndicator"; this.Padding = new Thickness(0, Device.OnPlatform(20, 0, 0), 0, 0); this.Content = abs; SizeChanged += AbsolutePageCS_SizeChanged; }
public MasterView(MenuViewModel viewModel) { this.BindingContext = viewModel; this.Title = "Title"; var layout = new StackLayout { Spacing = 0 }; var listView = new ListView(); var cell = new DataTemplate(typeof(ImageCell)); cell.SetBinding(TextCell.TextProperty, MenuViewModel.TitlePropertyName); cell.SetBinding(ImageCell.ImageSourceProperty, "Icon"); listView.ItemTemplate = cell; listView.ItemsSource = viewModel.MenuItems; if (about == null) about = new AboutView(); PageSelection = about; listView.ItemSelected += (sender, args) => { var menuItem = listView.SelectedItem as HomeMenuItem; menuType = menuItem.MenuType; switch (menuItem.MenuType) { case MenuType.Home: if (home == null) home = new HomeView(); PageSelection = home; break; case MenuType.About: if (about == null) about = new AboutView(); PageSelection = about; break; case MenuType.Feedback: if (feedback == null) feedback = new FeedbackView(); PageSelection = feedback; break; } }; listView.SelectedItem = viewModel.MenuItems[0]; layout.Children.Add(listView); this.Content = layout; }
public FcpItems() { ReadItems(); ReceiveItems(); var cell = new DataTemplate(typeof(ImageCell)); cell.SetBinding(ImageCell.ImageSourceProperty, "Image"); cell.SetBinding(TextCell.TextProperty, "Name"); listview.ItemTemplate = cell; listview.ItemsSource = Cells; Content = listview; }
public CascadeListView(List<CasecadeItems> data) { ItemsSource = data; HorizontalOptions = LayoutOptions.End; BackgroundColor = Color.Transparent; var cell = new DataTemplate(typeof(MenuCell)); cell.SetBinding(TextCell.TextProperty, "ID"); cell.SetBinding(TextCell.TextProperty, "Title"); cell.SetBinding(TextCell.TextProperty, "Level"); ItemTemplate = cell; }
public RecentRatingsView () { _viewModel = new RecentRatingsViewModel (this); BindingContext = _viewModel; Title = _viewModel.Title; BackgroundColor = Color.White; var cell = new DataTemplate (typeof(CardView)); cell.SetBinding (CardView.CheeseNameProperty, "CheeseName"); cell.SetBinding (CardView.DairyNameProperty, "DairyName"); cell.SetBinding (CardView.NotesProperty, "Notes"); cell.SetBinding (CardView.WedgeRatingProperty, "WedgeRating"); ListView listOfRatings = new ListView (); listOfRatings.HasUnevenRows = true; listOfRatings.SetBinding (ListView.ItemsSourceProperty, "RatingList"); listOfRatings.ItemTemplate = cell; listOfRatings.BackgroundColor = Color.White; listOfRatings.SeparatorVisibility = SeparatorVisibility.None; listOfRatings.ItemSelected += async (sender, e) => { var selectedRating = e.SelectedItem as CheeseAndRating; if (selectedRating != null) { await Navigation.PushAsync (new RatingDetailView (selectedRating)); listOfRatings.SelectedItem = null; } }; var addNewButton = new Button { Text = "Add New Rating", BackgroundColor = CheeseColors.RED, TextColor = Color.White, FontSize = 18, FontAttributes = FontAttributes.Bold, BorderRadius = 0 }; addNewButton.Clicked += AddNewCheese; var headerImage = new Image { Source = "Rectangle1.png", Aspect = Aspect.AspectFill }; Content = new StackLayout { Children = { headerImage, listOfRatings, addNewButton }, Padding = new Thickness (0, 0, 0, 1) }; }
public MenuListView (List<MenuItem> items) { ItemsSource = items; VerticalOptions = LayoutOptions.FillAndExpand; BackgroundColor = Color.Transparent; var cell = new DataTemplate (typeof(ImageCell)); cell.SetBinding (TextCell.TextProperty, "Title"); cell.SetBinding (ImageCell.ImageSourceProperty, "IconSource"); cell.SetBinding (VisualElement.BackgroundColorProperty, "BackgroundColor"); ItemTemplate = cell; }
public MenuListView() { List<MenuItem> data = MenuListData.MenuListItems.ToList(); ItemsSource = data; VerticalOptions = LayoutOptions.FillAndExpand; BackgroundColor = Color.Transparent; var cell = new DataTemplate (typeof(ImageCell)); cell.SetBinding (TextCell.TextProperty, "Title"); cell.SetBinding (ImageCell.ImageSourceProperty, "IconSource"); ItemTemplate = cell; }