public ImageCellListPage ()
		{
			Title = "ImageCell List Gallery - Legacy";

			Device.OnPlatform (iOS: () => {
				if (Device.Idiom == TargetIdiom.Tablet) {
					Padding = new Thickness (0, 0, 0, 60);
				}
			});

			var dataTemplate = new DataTemplate (typeof (ImageCell));
			var stringToImageSourceConverter = new GenericValueConverter (
				obj => new FileImageSource {
					File = (string) obj
				}
				);
	
			dataTemplate.SetBinding (TextCell.TextProperty, new Binding ("Text"));
			dataTemplate.SetBinding (TextCell.TextColorProperty, new Binding ("TextColor"));
			dataTemplate.SetBinding (TextCell.DetailProperty, new Binding ("Detail"));
			dataTemplate.SetBinding (TextCell.DetailColorProperty, new Binding ("DetailColor"));
			dataTemplate.SetBinding (ImageCell.ImageSourceProperty, new Binding ("Image", converter: stringToImageSourceConverter));

			Random rand = new Random(250);

			var albums = new [] {
				"crimsonsmall.jpg",
				"oasissmall.jpg",
				"cover1small.jpg"
			};

			var label = new Label { Text = "I have not been selected" };

			var listView = new ListView {
				AutomationId = "ImageCellListView",
				ItemsSource = Enumerable.Range (0, 100).Select (i => new ImageCellTest {
					Text = "Text " + i,
					TextColor = i % 2 == 0 ? Color.Red : Color.Blue,
					Detail = "Detail " + i,
					DetailColor = i % 2 == 0 ? Color.Red : Color.Blue,
					Image = albums[rand.Next(0,3)]
				}),
				ItemTemplate = dataTemplate
			};

			listView.ItemSelected += (sender, args) => label.Text = "I was selected";

			Content = new StackLayout { Children = { label, listView } };

		}
Exemple #2
0
		// TODO Add gallerys for ViewCell, ListView and TableView
		public CellTypeList ()
		{
			var itemList = new List<CellNavigation> {
				new CellNavigation ("TextCell List", new TextCellListPage ()),
				new CellNavigation ("TextCell Table", new TextCellTablePage ()),
				new CellNavigation ("ImageCell List", new ImageCellListPage ()),
				new CellNavigation ("ImageCell Url List", new UrlImageCellListPage()),
				new CellNavigation ("ImageCell Table", new ImageCellTablePage ()),
				new CellNavigation ("SwitchCell List", new SwitchCellListPage ()),
				new CellNavigation ("SwitchCell Table", new SwitchCellTablePage ()),
				new CellNavigation ("EntryCell List", new EntryCellListPage ()),
				new CellNavigation ("EntryCell Table", new EntryCellTablePage ()),
				new CellNavigation ("ViewCell Image url table", new UrlImageViewCellListPage())
			};
			
			ItemsSource = itemList;

			var template = new DataTemplate (typeof (TextCell));
			template.SetBinding (TextCell.TextProperty, new Binding ("CellType"));

			ItemTemplate = template;
			ItemSelected += (s, e) => {
				if (SelectedItem == null)
					return;

				var cellNav = (CellNavigation) e.SelectedItem;
				Navigation.PushAsync (cellNav.Page);
				SelectedItem = null;
			};
		}		
		public void SetBindingOverridesValue()
		{
			var template = new DataTemplate (typeof (MockBindable));
			template.SetValue (MockBindable.TextProperty, "value");
			template.SetBinding (MockBindable.TextProperty, new Binding ("."));

			MockBindable bindable = (MockBindable) template.CreateContent();
			Assume.That (bindable.GetValue (MockBindable.TextProperty), Is.EqualTo (bindable.BindingContext));

			bindable.BindingContext = "binding";
			Assert.That (bindable.GetValue (MockBindable.TextProperty), Is.EqualTo ("binding"));
		}
		public EntryCellListPage ()
		{
			Title = "EntryCell List Gallery - Legacy";

			Device.OnPlatform (iOS: () => {
				if (Device.Idiom == TargetIdiom.Tablet) {
					Padding = new Thickness (0, 0, 0, 60);
				}
			});

			var dataTemplate = new DataTemplate (typeof(EntryCell));
			dataTemplate.SetBinding (EntryCell.LabelProperty, new Binding ("Label"));
			dataTemplate.SetBinding (EntryCell.LabelColorProperty, new Binding ("LabelColor"));
			dataTemplate.SetBinding (EntryCell.PlaceholderProperty, new Binding ("Placeholder"));

			var label = new Label {
				Text = "I have not been selected"
			};

			var listView = new ListView {
				ItemsSource = Enumerable.Range (0, 100).Select (i => new EntryCellTest {
					Label = "Label " + i,
					LabelColor =  i % 2 == 0 ? Color.Red : Color.Blue,
					Placeholder = "Placeholder " + i,
					PlaceholderColor =  i % 2 == 0 ? Color.Red : Color.Blue,
				}),
				ItemTemplate = dataTemplate
			};

			listView.ItemSelected += (sender, args) => {
				label.Text = "I have been selected";
			};

			

			Content = new StackLayout { Children = { label, listView } };
		}
        public OutputPage(IEnumerable <Place> places)
        {
            this.Padding = 20;

            var template = new DataTemplate(typeof(ImageCell));

            template.SetBinding(ImageCell.TextProperty, "Name");
            template.SetBinding(ImageCell.DetailProperty, "Vicinity");
            template.SetBinding(ImageCell.ImageSourceProperty, "Icon");

            var list = new ListView {
                ItemsSource = places.Take(20), ItemTemplate = template
            };

            list.ItemSelected += (sender, e) => {
                if (e.SelectedItem == null)
                {
                    return;
                }
                (new Geocoder()).LaunchMapApp((Place)e.SelectedItem);
            };

            Content = list;
        }
        public MainPage()
        {
            InitializeComponent();

            addButton.Clicked += AddButton_Clicked;

            // generate, assign to list view, never touch it again
            DataTemplate dt = new DataTemplate(typeof(TextCell)); // any of the default cells could go here

            //set bindings manually
            dt.SetBinding(TextCell.TextProperty, new Binding("Text")); //tell it what binding object to assign to it

            //set another prop of Data template
            dt.SetBinding(TextCell.DetailProperty, new Binding("Date"));

            //set options within the cell
            dt.SetValue(TextCell.TextColorProperty, Color.DarkGreen);

            // set item template to new data template created ^
            ListView.ItemTemplate = dt;

            // ask list view to let us know when an item gets selected
            ListView.ItemSelected += ListView_ItemSelected;
        }
Exemple #7
0
        public void SelectedItemSetBeforeTemplate()
        {
            var page = CreateMultiPage();

            string[] items = new[] { "foo", "bar" };
            page.ItemsSource  = items;
            page.SelectedItem = items[1];

            var template = new DataTemplate(typeof(ContentPage));

            template.SetBinding(ContentPage.TitleProperty, ".");
            page.ItemTemplate = template;

            Assert.That(page.SelectedItem, Is.SameAs(items[1]));
        }
        public MenuListView()
        {
            List <MenuItem> data = new MenuListData();

            ItemsSource     = data;
            VerticalOptions = LayoutOptions.FillAndExpand;
            BackgroundColor = Color.Transparent;

            var cell = new DataTemplate(typeof(MenuCell));

            cell.SetBinding(MenuCell.TextProperty, "Titulo");


            ItemTemplate = cell;
        }
        public ListPage(BaseViewModel <T> viewModel) : base(viewModel)
        {
            //Set value will directly set the value to "List"
            this.SetValue(Page.TitleProperty, "List");
            //This will bind to our BindingContext.Icon
            this.SetBinding(Page.IconProperty, "Icon");

            var list = new ListView();

            //Bind the items in our list to the observable collection of models
            list.ItemsSource = ViewModel.Models;

            Cell = new DataTemplate(typeof(ListTextCell));

            //Bind our cell's text and details properties
            Cell.SetBinding(TextCell.TextProperty, "FirstName");
            Cell.SetBinding(TextCell.DetailProperty, "Industry");

            list.ItemTemplate = Cell;

            list.ItemSelected += (sender, e) =>
            {
                if (e.SelectedItem == null)
                {
                    return;
                }
                var details = new DetailPage <T>(e.SelectedItem as T);
                Navigation.PushAsync(details);
                //deselect item when pushing
                list.SelectedItem = null;
            };
            var stack = new StackLayout();

            stack.Children.Add(list);
            Content = stack;
        }
Exemple #10
0
        public ChildPage()
        {
            var template = new DataTemplate(typeof(ImageCell));

            template.SetBinding(ImageCell.ImageSourceProperty, nameof(ImageVM.Source));
            var listView = new ListView
            {
                ItemTemplate = template,
                ItemsSource  = Enumerable.Repeat(new ImageVM {
                    Source = "icon.png"
                }, 20).ToList()
            };

            Content = listView;
        }
Exemple #11
0
        public TextCellListPage()
        {
            Title = "TextCell List Gallery - Legacy";

            if (Device.RuntimePlatform == Device.iOS && Device.Idiom == TargetIdiom.Tablet)
            {
                Padding = new Thickness(0, 0, 0, 60);
            }

            var label = new Label {
                Text = "Not Selected"
            };

            var dataTemplate = new DataTemplate(typeof(TextCell));

            dataTemplate.SetBinding(TextCell.TextProperty, new Binding("Text"));
            dataTemplate.SetBinding(TextCell.TextColorProperty, new Binding("TextColor"));
            dataTemplate.SetBinding(TextCell.DetailProperty, new Binding("Detail"));
            dataTemplate.SetBinding(TextCell.DetailColorProperty, new Binding("DetailColor"));

            var listView = new ListView {
                ItemsSource = Enumerable.Range(0, 100).Select(i => new TextCellTest {
                    Text        = "Text " + i,
                    TextColor   = i % 2 == 0 ? Color.Red : Color.Blue,
                    Detail      = "Detail " + i,
                    DetailColor = i % 2 == 0 ? Color.Red : Color.Blue
                }),
                ItemTemplate = dataTemplate
            };

            listView.ItemSelected += (sender, args) => { label.Text = "I was selected"; };

            Content = new StackLayout {
                Children = { label, listView }
            };
        }
Exemple #12
0
        public ItemDetailsPage(Item item)
        {
            _item = item;
            Title = "Item Photos";
            //Setup carousel
            DataTemplate it = new DataTemplate(typeof(ZoomableWebView));

            it.SetBinding(ZoomableWebView.SourceProperty, new Binding(".", converter: new ImageUrlHtmlValueConverter()));
            _carouselV = new CarouselViewControl {
                ShowIndicators   = true,
                ShowArrows       = false,
                InterPageSpacing = 10,
                ItemTemplate     = it
            };
            Content = _carouselV;
        }
        public SelectedPokemonPage()
        {
            BindingContext = (App.Current as App).PokemonsViewModel;
            Title          = "Elegidos";

            var selectedListView = new ListView();

            selectedListView.SetBinding(ListView.ItemsSourceProperty, "SelectedPokemons");

            var textCell = new DataTemplate(typeof(TextCell));

            textCell.SetBinding(TextCell.TextProperty, "Name");
            selectedListView.ItemTemplate = textCell;

            Content = selectedListView;
        }
Exemple #14
0
        protected override async void OnAppearing()
        {
            base.OnAppearing();

            //Omvandlar textens färg från Rosa (standard) till Svart
            var template = new DataTemplate(typeof(TextCell));

            template.SetValue(TextCell.TextColorProperty, Color.Black);
            template.SetBinding(TextCell.TextProperty, ".");
            testcreditcardslist.ItemTemplate         = template;
            testscenariocreditcardslist.ItemTemplate = template;
            await SendNotificationNow();
            await ScheduleLocalNotification(DateTimeOffset.UtcNow.AddMinutes(1));

            await DisplayAlert("Alert", "Skriv inte in ditt eget kort", "OK");
        }
		public CheeseSearchView ()
		{
			viewModel = new SearchReviewsViewModel ();

			this.BindingContext = viewModel;

			Title = "Search Cheese Reviews!";
			searchResults = new ListView ();
			searchBar = new SearchBar () { Placeholder = "Reviewer Email" };

			// Search bar doesn't seem to want to bind 
			// to the command parameter for some reason
			// hack our way to make it work
			searchBar.TextChanged += (sender, e) => {
				viewModel.EmailAddress = ((SearchBar)sender).Text;
			};

			searchResults.SetBinding (ListView.ItemsSourceProperty, "Reviews");

			var cell = new DataTemplate (typeof(TextCell));
			cell.SetBinding (TextCell.TextProperty, "Display");

			searchResults.ItemTemplate = cell;


			var addButtonItem = new ToolbarItem ();
			addButtonItem.Text = "Add";
			addButtonItem.Clicked += async (sender, e) => {
				var addReview = new AddReviewView();

				var navPage = new NavigationPage(addReview);

				await Navigation.PushModalAsync(navPage);
			};

			this.ToolbarItems.Add (addButtonItem);

			searchBar.SearchCommandParameter = searchBar.Text;
			searchBar.SearchCommand = viewModel.SearchReviewsCommand;

			Content = new StackLayout { 
				Children = {
					searchBar,
					searchResults
				}
			};
		}
Exemple #16
0
		protected override void Init ()
		{
			var cells = new [] {
				new NavPageNameObject ("Close Master"),
				new NavPageNameObject ("Page 1"),
				new NavPageNameObject ("Page 3"),
				new NavPageNameObject ("Page 4"),
				new NavPageNameObject ("Page 5"),
				new NavPageNameObject ("Page 6"),
				new NavPageNameObject ("Page 7"),
				new NavPageNameObject ("Page 8"),
			};

			var template = new DataTemplate (typeof (TextCell));
			template.SetBinding (TextCell.TextProperty, "PageName");

			var listView = new ListView { 
				ItemTemplate = template,
				ItemsSource = cells
			};

			listView.BindingContext = cells;

			listView.ItemTapped += (sender, e) => {
				var cellName = ((NavPageNameObject)e.Item).PageName;
				if (cellName == "Close Master") {
					IsPresented = false;
				} else {
					Detail = new CustomNavDetailPage (cellName);
				}
			};

			var master = new ContentPage {
				Padding = new Thickness(0, 20, 0, 0),
				Title = "Master",
				Content = listView
			};
				
			Master = master;
			Detail = new CustomNavDetailPage ("Initial Page");

			MessagingCenter.Subscribe<NestedNavPageRootView> (this, "PresentMaster", (sender) => {
				IsPresented = true;
			});
		}
			public ListViewTest ()
			{
				Title = "List Page";

				var items = new[] {
					new TabbedPageWithListName () { Name = "Jason" },
					new TabbedPageWithListName () { Name = "Ermau" },
					new TabbedPageWithListName () { Name = "Seth" }
				};

				var cellTemplate = new DataTemplate (typeof(TextCell));
				cellTemplate.SetBinding (TextCell.TextProperty, "Name");

				Content = new ListView () {
					ItemTemplate = cellTemplate,
					ItemsSource = items
				};
			}
Exemple #18
0
        protected async override void OnAppearing()
        {
            base.OnAppearing();
            var client = new HttpClient();

            client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));
            client.DefaultRequestHeaders.Authorization = new System.Net.Http.Headers.AuthenticationHeaderValue("Bearer", App.AuthenticationResult.AccessToken);
            var response = await client.GetStringAsync("https://graph.microsoft.com/beta/me/messages");

            var result = JsonConvert.DeserializeObject <MailResponse>(response);

            listView.ItemsSource = result.Value;
            var cell = new DataTemplate(typeof(TextCell));

            //this below will use the default cell properties but will customize it later
            cell.SetBinding(TextCell.TextProperty, "Subject");
            listView.ItemTemplate = cell;
        }
Exemple #19
0
        // TODO Add gallerys for ViewCell, ListView and TableView
        public CellTypeList()
        {
            var itemList = new List <CellNavigation> {
                new CellNavigation("TextCell List", new TextCellListPage()),
                new CellNavigation("TextCell Table", new TextCellTablePage()),
                new CellNavigation("ImageCell List", new ImageCellListPage()),
                new CellNavigation("ImageCell Url List", new UrlImageCellListPage()),
                new CellNavigation("ImageCell Table", new ImageCellTablePage()),
                new CellNavigation("SwitchCell List", new SwitchCellListPage()),
                new CellNavigation("SwitchCell Table", new SwitchCellTablePage()),
                new CellNavigation("EntryCell List", new EntryCellListPage()),
                new CellNavigation("EntryCell Table", new EntryCellTablePage()),
                new CellNavigation("ViewCell Image url table", new UrlImageViewCellListPage())
            };

            ItemsSource = itemList;

            var template = new DataTemplate(typeof(TextCell));

            template.SetBinding(TextCell.TextProperty, new Binding("CellType"));

            ItemTemplate  = template;
            ItemSelected += (s, e) =>
            {
                if (SelectedItem == null)
                {
                    return;
                }

                var cellNav = (CellNavigation)e.SelectedItem;

                if (cellNav == _last)
                {
                    _last = null;
                    return;
                }

                Navigation.PushAsync(cellNav.Page);
                _last = cellNav;
#if !WINDOWS
                SelectedItem = null;
#endif
            };
        }
Exemple #20
0
        private void CreateTemplate(bool isTileVisible)
        {
            var template = new DataTemplate(typeof(ShowCell));

            template.SetBinding(ShowCell.CommandProperty, "GoToMoviePageCommand");
            template.SetBinding(ShowCell.TitleProperty, "Title");
            template.SetBinding(ShowCell.RatingProperty, "Rating");
            template.SetBinding(ShowCell.GenreProperty, "Genre");
            template.SetBinding(ShowCell.ShowsProperty, "Shows");
            template.SetBinding(ShowCell.ImageSourceProperty, "ImageSource");
            template.SetValue(ShowCell.IsTileVisibleProperty, isTileVisible);
            RepertoireList.ItemTemplate = template;
        }
Exemple #21
0
        public FooView()
        {
            var list = new ListView();

            list.SetBinding(ListView.ItemsSourceProperty, new Binding("Names"));

            var cell = new DataTemplate(typeof(TextCell));

            cell.SetBinding(TextCell.TextProperty, "MonkeyName");

            list.ItemTemplate = cell;

            Content = new StackLayout {
                Children =
                {
                    list
                }
            };
        }
Exemple #22
0
			public ListViewTest()
			{
				Title = "List Page";

				var items = new[] {
					new TabbedPageWithListName () { Name = "Jason" },
					new TabbedPageWithListName () { Name = "Ermau" },
					new TabbedPageWithListName () { Name = "Seth" }
				};

				var cellTemplate = new DataTemplate(typeof(TextCell));
				cellTemplate.SetBinding(TextCell.TextProperty, "Name");

				Content = new ListView()
				{
					ItemTemplate = cellTemplate,
					ItemsSource = items
				};
			}
Exemple #23
0
            public GroupedItemsPage()
            {
                listView = new ListView(ListViewCachingStrategy.RetainElement)
                {
                    HasUnevenRows = true
                };
                listView.IsGroupingEnabled = true;
                listView.ItemTemplate      = new GroupedItemsDataTemplateSelector();

                var headerCell = new DataTemplate(typeof(TextCell));

                headerCell.SetBinding(TextCell.TextProperty, "Key");
                this.listView.GroupHeaderTemplate = headerCell;

                this.model = new ObservableCollection <Grouping <string, GroupedItem> >();
                this.GetItems();

                this.SetMainContent();
            }
Exemple #24
0
        async void OnTextChanged(Object sender, EventArgs e)
        {
            //Add temporary loading indicator
            stack.Children.Remove(list);
            stack.Children.Add(loading);

            string googleKey = "AIzaSyA3aaKi6HVMDLcvez0EGcMn6Fsngl5lC5g";
            string dirUrl    = "https://maps.googleapis.com/maps/api/place/autocomplete/json?input=";

            dirUrl += searchBar.Text;
            dirUrl += "&location=43.068152,-89.409759&radius=10000&key=" + googleKey;

            //Get new autocomplete suggestions when search text is changed
            var response = await SendRequest(dirUrl);

            if (!response.IsSuccessStatusCode)
            {
                System.Diagnostics.Debug.WriteLine("Bad Address?");
            }
            else
            {
                string content = await response.Content.ReadAsStringAsync();

                System.Diagnostics.Debug.WriteLine(content);
                PlacesResponse pParsed = JsonConvert.DeserializeObject <PlacesResponse>(content);

                //Set up list template to display the descriptions of the autocomplete predictions
                var temp = new DataTemplate(typeof(TextCell));
                temp.SetBinding(TextCell.TextProperty, "description");
                temp.SetValue(TextCell.TextColorProperty, Color.Black);

                //Set up the list with the autocomplete predictions
                list.ItemsSource  = pParsed.predictions;
                list.ItemTemplate = temp;

                //Remove loading indicator and show list
                stack.Children.Remove(loading);
                stack.Children.Add(list);
            }

            searchBar.Focus();
        }
Exemple #25
0
        public ComplexObjectListViewPage()
        {
            var cities = new List <City> ()
            {
                new City()
                {
                    State = "FL", Name = "Miami"
                },
                new City()
                {
                    State = "CA", Name = "San Francisco"
                },
                new City()
                {
                    State = "CA", Name = "Los Angeles"
                },
                new City()
                {
                    State = "FL", Name = "Orlando"
                },
                new City()
                {
                    State = "TX", Name = "Houston"
                },
                new City()
                {
                    State = "NY", Name = "New York City"
                },
            };

            var dataTemplate = new DataTemplate(typeof(TextCell));

            dataTemplate.SetBinding(TextCell.TextProperty, "Name");

            var listView = new ListView()
            {
                ItemsSource  = cities,
                ItemTemplate = dataTemplate
            };

            Content = listView;
        }
Exemple #26
0
        protected override void Init()
        {
            var cells = new[] {
                new NavPageNameObject("Page 1"),
                new NavPageNameObject("Page 3"),
                new NavPageNameObject("Page 4"),
                new NavPageNameObject("Page 5"),
                new NavPageNameObject("Page 6"),
                new NavPageNameObject("Page 7"),
                new NavPageNameObject("Page 8"),
            };

            var template = new DataTemplate(typeof(TextCell));

            template.SetBinding(TextCell.TextProperty, "PageName");

            var listView = new ListView
            {
                ItemTemplate = template,
                ItemsSource  = cells
            };

            listView.BindingContext = cells;

            listView.ItemTapped += (sender, e) =>
            {
                var cellName = ((NavPageNameObject)e.Item).PageName;
                Detail = new CustomNavTabDetailPage(cellName);
            };

            var master = new ContentPage
            {
                Title           = "Flyout",
                IconImageSource = "bank.png",
                Content         = listView
            };



            Flyout = master;
            Detail = new CustomNavTabDetailPage("Initial Page");
        }
Exemple #27
0
        public TodoListView()
        {
            List <TodoItems> data = new TodoListData();

            ItemsSource       = data;
            HorizontalOptions = LayoutOptions.End;
            BackgroundColor   = Color.Transparent;
            var cell = new DataTemplate(typeof(MenuCell));

            cell.SetBinding(TextCell.TextProperty, "Title");
            cell.SetBinding(TextCell.TextProperty, "Date");
            cell.SetBinding(TextCell.TextProperty, "sTimeStr");
            cell.SetBinding(TextCell.TextProperty, "fTimeStr");
            cell.SetBinding(TextCell.TextProperty, "PercentStr");
            cell.SetBinding(TextCell.TextProperty, "Field");
            cell.SetBinding(ImageCell.ImageSourceProperty, "IconSource");
            ItemTemplate = cell;
        }
        public SkillView(Skill selectedItem)
        {
            Title = "Skill - " + selectedItem.title;

            var listView = new ListView();

            listView.ItemsSource = selectedItem.levels;

            var cell = new DataTemplate(typeof(TextCell));

            cell.SetBinding(TextCell.TextProperty, "title");

            listView.ItemTemplate = cell;
            listView.ItemTapped  += (sender, args) =>
            {
                listView.SelectedItem = null;
            };

            Content = listView;
        }
Exemple #29
0
        public MyPage()
        {
            List <string[]> array = new List <string[]>()
            {
                new string[] { "1", "hello" },
                new string[] { "2", "world" },
                new string[] { "3", "hello" }
            };

            list = new ListView();

            var cell = new DataTemplate(typeof(TextCell));

            cell.SetBinding(TextCell.TextProperty, ".[1]");
            list.ItemTemplate = cell;

            list.ItemsSource = array;

            Content = list;
        }
Exemple #30
0
        //what the menu page will look like
        public MenuPage()
        {
            var data = new MenuListData();

            Title           = "menu"; // The Title property must be set.
            BackgroundColor = Color.Teal;
            Icon            = new FileImageSource {
                File = "robot.png"
            };

            Menu = new ListView()
            {
                SeparatorVisibility = SeparatorVisibility.Default,
                SeparatorColor      = Color.Teal,
                BackgroundColor     = Color.Gray
            };
            Menu.ItemsSource = data;
            //aspect of each of the menus cells that will contain the page title
            var cell = new DataTemplate(typeof(TextCell));

            cell.SetBinding(TextCell.TextProperty, "Title");
            Menu.ItemTemplate = cell;

            var menuLabel = new ContentView
            {
                Padding = new Thickness(10, 30, 0, 5),
                Content = new Label
                {
                    Text = "MENU",
                }
            };

            var layout = new StackLayout
            {
                Spacing         = 0,
                VerticalOptions = LayoutOptions.FillAndExpand
            };

            layout.Children.Add(menuLabel);
            layout.Children.Add(Menu);
        }
Exemple #31
0
        public void DataTemplateSetBindingWithNullBindingBase()
        {
            tlog.Debug(tag, $"DataTemplateSetBindingWithNullBindingBase START");

            BindableProperty stateProperty = BindableProperty.CreateAttached("State", typeof(bool), typeof(XamlPropertyCondition), false, propertyChanged: OnStatePropertyChanged);

            var testingTarget = new DataTemplate();

            Assert.IsNotNull(testingTarget, "Can't create success object DataTemplate");
            Assert.IsInstanceOf <DataTemplate>(testingTarget, "Should be an instance of DataTemplate type.");

            try
            {
                testingTarget.SetBinding(stateProperty, null);
            }
            catch (ArgumentNullException e)
            {
                tlog.Debug(tag, $"DataTemplateSetValueWithNullBindableProperty END (OK)");
                Assert.Pass("Caught ArgumentNullException: Pass!");
            }
        }
Exemple #32
0
        public void DataTemplateSetBindingWithNullBindableProperty()
        {
            tlog.Debug(tag, $"DataTemplateSetBindingWithNullBindableProperty START");

            BindingBase binding = new Tizen.NUI.Binding.Binding() as BindingBase;

            var testingTarget = new DataTemplate();

            Assert.IsNotNull(testingTarget, "Can't create success object DataTemplate");
            Assert.IsInstanceOf <DataTemplate>(testingTarget, "Should be an instance of DataTemplate type.");

            try
            {
                testingTarget.SetBinding(null, binding);
            }
            catch (ArgumentNullException e)
            {
                tlog.Debug(tag, $"DataTemplateSetValueWithNullBindableProperty END (OK)");
                Assert.Pass("Caught ArgumentNullException: Pass!");
            }
        }
        public InvitationPage()
        {
            Title = "My Invitations";
            NavigationPage.SetTitleIcon(this, "bar_icon");
            BackgroundColor = Color.White;

            var template = new DataTemplate(typeof(TextCell));

            template.SetBinding(TextCell.TextProperty, "Name");

            list = new ListView {
                ItemsSource    = App.User.PotentialProjects,
                SeparatorColor = Color.Gray,
                ItemTemplate   = template
            };
            list.ItemSelected += async(sender, e) => await ProjectSelected(sender as ListView);

            list.RefreshCommand = new Command(async() => await RefreshList());

            Content.AddView(list, 0, 0, 1, 1);
        }
        public StationSelectPage(bool isLaunchStation)
        {
            InitializeComponent();
            this.isLaunchStation = isLaunchStation;

            if (!SearchViewModel.existsData(FavoriteStations_ID))
            {
                SearchViewModel.saveData(FavoriteStations_ID, new List <string>());
            }

            //var itemsList = getFullItemsList();
            var itemsList = SearchViewModel.loadData <List <string> >(FavoriteStations_ID);

            setItemsSource(ListView_SearchedStationNames, itemsList);
            //ListView_SearchedStationNames.ItemsSource = getFullItemsList();

            var template = new DataTemplate(typeof(TextCell));

            template.SetValue(TextCell.TextColorProperty, Color.Black);
            template.SetBinding(TextCell.TextProperty, "Text");
            ListView_SearchedStationNames.ItemTemplate = template;
        }
        //public TypeCellDataTemplateSelector instance = new TypeCellDataTemplateSelector();

        public TypeCellDataTemplateSelector()
        {
            XActionSheetCellTemplate = new DataTemplate(typeof(XActionSheetCell));
            XActionSheetCellTemplate.SetBinding(XTitleBaseViewCell.TitleProperty, XTitleBaseViewCell.TitleProperty.PropertyName);
            XActionSheetCellTemplate.SetBinding(XTitleBaseViewCell.TitleColorProperty, XTitleBaseViewCell.TitleColorProperty.PropertyName);
            XActionSheetCellTemplate.SetBinding(XTitleBaseViewCell.TitleFontSizeProperty, XTitleBaseViewCell.TitleFontSizeProperty.PropertyName);
            XActionSheetCellTemplate.SetBinding(XTitleBaseViewCell.DetailProperty, XTitleBaseViewCell.DetailProperty.PropertyName);

            XActionSheetCellTemplate.SetBinding(XActionSheetCell.TextProperty, XActionSheetCell.TextProperty.PropertyName);
            XActionSheetCellTemplate.SetBinding(XActionSheetCell.SelectorTitleProperty, XActionSheetCell.SelectorTitleProperty.PropertyName);
            XActionSheetCellTemplate.SetBinding(XActionSheetCell.CancelTitleProperty, XActionSheetCell.CancelTitleProperty.PropertyName);

            XDateCellTemplate = new DataTemplate(typeof(XDateCell));
            XDateCellTemplate.SetBinding(XTitleBaseViewCell.DetailProperty, XTitleBaseViewCell.DetailProperty.PropertyName);
            XDateCellTemplate.SetBinding(XTitleBaseViewCell.TitleProperty, XTitleBaseViewCell.TitleProperty.PropertyName);
            XDateCellTemplate.SetBinding(XTitleBaseViewCell.TitleColorProperty, XTitleBaseViewCell.TitleColorProperty.PropertyName);
            XDateCellTemplate.SetBinding(XTitleBaseViewCell.TitleFontSizeProperty, XTitleBaseViewCell.TitleFontSizeProperty.PropertyName);
            XDateCellTemplate.SetBinding(XProperties.DateProperty, XProperties.DateProperty.PropertyName);
            XDateCellTemplate.SetBinding(XProperties.FormatProperty, XProperties.FormatProperty.PropertyName);
        }
        public SelectableInputView(string titleText, IList <string> selectiondataSource,
                                   string saveButtonText, string cancelButtonText, string validationText)
        {
            InitializeComponent();

            // update the Element's textual values
            TitleLabel.Text = titleText;

            var template = new DataTemplate(typeof(TextCell));

            template.SetBinding(TextCell.TextProperty, "String");

            SelectionListView.ItemsSource = selectiondataSource;
            SaveButton.Text      = saveButtonText;
            CancelButton.Text    = cancelButtonText;
            ValidationLabel.Text = validationText;

            // handling events to expose to public
            SaveButton.Clicked             += SaveButton_Clicked;
            CancelButton.Clicked           += CancelButton_Clicked;
            SelectionListView.ItemSelected += InputEntryOnItemSelected;
        }
		public UrlImageCellListPage()
		{
			Device.OnPlatform (iOS: () => {
				if (Device.Idiom == TargetIdiom.Tablet) {
					Padding = new Thickness (0, 0, 0, 60);
				}
			});

			var dataTemplate = new DataTemplate (typeof (ImageCell));
			var stringToImageSourceConverter = new GenericValueConverter (
				obj => new UriImageSource() {
					Uri = new Uri ((string) obj)
				});

			dataTemplate.SetBinding (TextCell.TextProperty, new Binding ("Text"));
			dataTemplate.SetBinding (TextCell.TextColorProperty, new Binding ("TextColor"));
			dataTemplate.SetBinding (TextCell.DetailProperty, new Binding ("Detail"));
			dataTemplate.SetBinding (TextCell.DetailColorProperty, new Binding ("DetailColor"));
			dataTemplate.SetBinding (ImageCell.ImageSourceProperty,
				new Binding ("Image", converter: stringToImageSourceConverter));

			var albums = new List<string> ();
			for (int i = 0; i < 30; i++) {
				albums.Add (string.Format ("http://cdn.instructables.com/FCP/9TOJ/GCJ0ZQV5/FCP9TOJGCJ0ZQV5.MEDIUM.jpg?ticks={0}",i ));
			}


			var random = new Random();
			var label = new Label { Text = "I have not been selected" };

			var listView = new ListView {
				AutomationId = "ImageUrlCellListView",
				ItemsSource = Enumerable.Range (0, 300).Select (i => new ImageCellTest {
					Text = "Text " + i,
					TextColor = i % 2 == 0 ? Color.Red : Color.Blue,
					Detail = "Detail " + i,
					DetailColor = i % 2 == 0 ? Color.Red : Color.Blue,
					Image = albums [random.Next (0, albums.Count - 1)]
				}),
				ItemTemplate = dataTemplate
			};

			listView.ItemSelected += (sender, args) => label.Text = "I was selected";

			Content = new StackLayout { Children = { label, listView } };

		}
Exemple #38
0
		public CoreRootView ()
		{
			var roots = new [] {
				new CoreViewContainer ("SwapRoot - CarouselPage", typeof(CoreCarouselPage)), 
				new CoreViewContainer ("SwapRoot - ContentPage", typeof(CoreContentPage)),
				new CoreViewContainer ("SwapRoot - MasterDetailPage", typeof(CoreMasterDetailPage)),
				new CoreViewContainer ("SwapRoot - NavigationPage", typeof(CoreNavigationPage)),
				new CoreViewContainer ("SwapRoot - TabbedPage", typeof(CoreTabbedPage)),
			};

			var template = new DataTemplate (typeof(TextCell));
			template.SetBinding (TextCell.TextProperty, "Name");

			ItemTemplate = template;
			ItemsSource = roots;

#if PRE_APPLICATION_CLASS
			ItemSelected += (sender, args) => MessagingCenter.Send (this, Messages.ChangeRoot, ((CoreViewContainer)args.SelectedItem).PageType);
#else			
			ItemSelected += (sender, args) => {
				var app = Application.Current as App;
				if (app != null) {
					var page = (Page)Activator.CreateInstance (((CoreViewContainer)args.SelectedItem).PageType);
					app.SetMainPage (page);
				}		
			};
#endif
		}
Exemple #39
0
		public CorePageView (Page rootPage, NavigationBehavior navigationBehavior = NavigationBehavior.PushAsync)
		{
			var pages = new List<Page> {
				new AppLinkPageGallery {Title = "App Link Page Gallery"},
				new NestedNativeControlGalleryPage {Title = "Nested Native Controls Gallery"},
				new CellForceUpdateSizeGalleryPage {Title = "Cell Force Update Size Gallery"},
				new AppearingGalleryPage {Title = "Appearing Gallery"},
				new EntryCoreGalleryPage { Title = "Entry Gallery" },
				new NavBarTitleTestPage {Title = "Titles And Navbar Windows"},
				new PanGestureGalleryPage {Title = "Pan gesture Gallery"},
				new PinchGestureTestPage {Title = "Pinch gesture Gallery"},
				new AutomationIdGallery { Title ="AutomationID Gallery" },
				new LayoutPerformanceGallery {Title = "Layout Perf Gallery"},
				new ListViewSelectionColor { Title = "ListView SelectionColor Gallery" },
				new AlertGallery { Title = "DisplayAlert Gallery" },
				new ToolbarItems { Title = "ToolbarItems Gallery" },
				new ActionSheetGallery { Title = "ActionSheet Gallery" }, 
				new ActivityIndicatorCoreGalleryPage { Title = "ActivityIndicator Gallery" },
				new BehaviorsAndTriggers { Title = "BehaviorsTriggers Gallery" },
				new ContextActionsGallery { Title = "ContextActions List Gallery"},
				new ContextActionsGallery (tableView: true) { Title = "ContextActions Table Gallery"},
				new CoreBoxViewGalleryPage { Title = "BoxView Gallery" },
				new ButtonCoreGalleryPage { Title = "Button Gallery" },
				new DatePickerCoreGalleryPage { Title = "DatePicker Gallery" },
				new EditorCoreGalleryPage { Title = "Editor Gallery" },
				new FrameCoreGalleryPage { Title = "Frame Gallery" },
				new ImageCoreGalleryPage { Title = "Image Gallery" },
				new KeyboardCoreGallery { Title = "Keyboard Gallery" },
				new LabelCoreGalleryPage { Title = "Label Gallery" },
				new ListViewCoreGalleryPage { Title = "ListView Gallery" },
				new OpenGLViewCoreGalleryPage { Title = "OpenGLView Gallery" },
				new PickerCoreGalleryPage { Title = "Picker Gallery" },
				new ProgressBarCoreGalleryPage { Title = "ProgressBar Gallery" },
				new ScrollGallery { Title = "ScrollView Gallery" }, 
				new ScrollGallery(ScrollOrientation.Horizontal) { Title = "ScrollView Gallery Horizontal" },
				new ScrollGallery(ScrollOrientation.Both) { Title = "ScrollView Gallery 2D" },
				new SearchBarCoreGalleryPage { Title = "SearchBar Gallery" },
				new SliderCoreGalleryPage { Title = "Slider Gallery" },
				new StepperCoreGalleryPage { Title = "Stepper Gallery" },
				new SwitchCoreGalleryPage { Title = "Switch Gallery" },
				new TableViewCoreGalleryPage { Title = "TableView Gallery" },
				new TimePickerCoreGalleryPage { Title = "TimePicker Gallery" },
				new WebViewCoreGalleryPage { Title = "WebView Gallery" },
				//pages
 				new RootContentPage ("Content") { Title = "RootPages Gallery" },
				new MasterDetailPageTabletPage { Title = "MasterDetailPage Tablet Page" },
				// legacy galleries
				new AbsoluteLayoutGallery { Title = "AbsoluteLayout Gallery - Legacy" }, 
				new BoundContentPage { Title = "BoundPage Gallery - Legacy" }, 
				new BackgroundImageGallery { Title = "BackgroundImage gallery" },
				new ButtonGallery { Title = "Button Gallery - Legacy" }, 
				new CarouselPageGallery { Title = "CarouselPage Gallery - Legacy" },
				new CellTypesListPage { Title = "Cells Gallery - Legacy" },
				new ClipToBoundsGallery { Title = "ClipToBounds Gallery - Legacy" }, 
				new ControlTemplatePage { Title = "ControlTemplated Gallery - Legacy" },
				new ControlTemplateXamlPage { Title = "ControlTemplated XAML Gallery - Legacy" },
				new DisposeGallery { Title = "Dispose Gallery - Legacy" }, 
				new EditorGallery { Title = "Editor Gallery - Legacy" },
				new EntryGallery { Title = "Entry Gallery - Legacy" }, 
				new FrameGallery  { Title = "Frame Gallery - Legacy" }, 
				new GridGallery { Title = "Grid Gallery - Legacy" }, 
				new GroupedListActionsGallery { Title = "GroupedListActions Gallery - Legacy" }, 
				new GroupedListContactsGallery { Title = "GroupedList Gallery - Legacy" },
				new ImageGallery  { Title = "Image Gallery - Legacy" },
				new ImageLoadingGallery  { Title = "ImageLoading Gallery - Legacy" },
				new InputIntentGallery { Title = "InputIntent Gallery - Legacy" },
				new LabelGallery { Title = "Label Gallery - Legacy" },
				new LayoutAddPerformance { Title = "Layout Add Performance - Legacy" },
				new LayoutOptionsGallery { Title = "LayoutOptions Gallery - Legacy" },
				new LineBreakModeGallery { Title = "LineBreakMode Gallery - Legacy" },
				new ListPage { Title = "ListView Gallery - Legacy" },
				new ListScrollTo { Title = "ListView.ScrollTo" },
				new ListRefresh { Title = "ListView.PullToRefresh" },
				new ListViewDemoPage { Title = "ListView Demo Gallery - Legacy" },
				new MapGallery { Title = "Map Gallery - Legacy" }, 
				new MinimumSizeGallery { Title = "MinimumSize Gallery - Legacy" },
				new MultiGallery { Title = "Multi Gallery - Legacy" },
				new NavigationMenuGallery { Title = "NavigationMenu Gallery - Legacy" },
				new NavigationPropertiesGallery { Title = "Navigation Properties" },
#if HAVE_OPENTK
				new OpenGLGallery { Title = "OpenGLGallery - Legacy" },
#endif
				new PickerGallery {Title = "Picker Gallery - Legacy"}, 
				new ProgressBarGallery { Title = "ProgressBar Gallery - Legacy" }, 
				new RelativeLayoutGallery { Title = "RelativeLayout Gallery - Legacy" },
				new ScaleRotate { Title = "Scale Rotate Gallery - Legacy" }, 
				new SearchBarGallery { Title = "SearchBar Gallery - Legacy" },
				new SettingsPage { Title = "Settings Page - Legacy" }, 
				new SliderGallery { Title = "Slider Gallery - Legacy" },
				new StackLayoutGallery { Title = "StackLayout Gallery - Legacy" }, 
				new StepperGallery { Title = "Stepper Gallery - Legacy" },
				new StyleGallery {Title = "Style Gallery"},
				new StyleXamlGallery {Title = "Style Gallery in Xaml"},
				new SwitchGallery { Title = "Switch Gallery - Legacy" }, 
				new TableViewGallery { Title = "TableView Gallery - Legacy" }, 
				new TemplatedCarouselGallery { Title = "TemplatedCarouselPage Gallery - Legacy" }, 
				new TemplatedTabbedGallery { Title = "TemplatedTabbedPage Gallery - Legacy" }, 
 				new UnevenViewCellGallery { Title = "UnevenViewCell Gallery - Legacy" }, 
				new UnevenListGallery { Title = "UnevenList Gallery - Legacy" }, 
				new ViewCellGallery { Title = "ViewCell Gallery - Legacy" }, 
				new WebViewGallery {Title = "WebView Gallery - Legacy"},
			};

			titleToPage = pages.ToDictionary (o => o.Title);

			// avoid NRE for root pages without NavigationBar
			if (navigationBehavior == NavigationBehavior.PushAsync && rootPage.GetType () == typeof (CoreNavigationPage)) {
				pages.Add (new NavigationBarGallery ((NavigationPage)rootPage) { Title = "NavigationBar Gallery - Legacy" });
			}

			var template = new DataTemplate (typeof(TextCell));
			template.SetBinding (TextCell.TextProperty, "Title");

			BindingContext = pages;
			ItemTemplate = template;
			ItemsSource = pages;

			ItemSelected += async (sender, args) => {
				if (SelectedItem == null)
					return;

				var item = args.SelectedItem;
				var page = item as Page;
				if (page != null)
					await PushPage (page);

				SelectedItem = null;
			};
		}
		public void SetBindingInvalid()
		{
			var template = new DataTemplate (typeof (MockBindable));
			Assert.That (() => template.SetBinding (null, new Binding (".")), Throws.InstanceOf<ArgumentNullException>());
			Assert.That (() => template.SetBinding (MockBindable.TextProperty, null), Throws.InstanceOf<ArgumentNullException>());
		}
Exemple #41
0
			public ListViewTextCellPage()
			{
				DataTemplate it = new DataTemplate(typeof(TextCell));
				it.SetBinding(TextCell.TextProperty, "Title");
				it.SetBinding(TextCell.DetailProperty, "SubTitle");
				ListView listV = new ListView
				{
					HasUnevenRows = true,
					ItemTemplate = it,
					ItemsSource = GetData()
				};
				Content = listV;
			}
Exemple #42
0
			public ListViewCustomCellPage(ListViewCachingStrategy strategy)
			{
				DataTemplate it = new DataTemplate(typeof(CustomCell));
				it.SetBinding(CustomCell.TextProperty, "Title");
				it.SetBinding(CustomCell.DetailProperty, "SubTitle");
				ListView listV = new ListView(strategy)
				{
					HasUnevenRows = true,
					ItemTemplate = it,
					ItemsSource = GetData()
				};
				Content = listV;
			}