public TodoListXaml () { InitializeComponent (); // same as the Xaml, but in code this.Padding = new Thickness(5, Device.OnPlatform(20, 0, 0), 0, 0); var tbi = new ToolbarItem ("+", null, () => { //TODO: something }, 0, 0); if (Device.OS == TargetPlatform.Android) { // BUG: Android doesn't support the icon being null //TODO: something } ToolbarItems.Add (tbi); listView.ItemsSource = new TodoItem [] { new TodoItem {Name = "Buy pears`"}, new TodoItem {Name = "Buy oranges`", Done=true}, new TodoItem {Name = "Buy mangos`"}, new TodoItem {Name = "Buy apples`", Done=true}, new TodoItem {Name = "Buy bananas`", Done=true} }; if (Device.OS == TargetPlatform.iOS) { var tbi2 = new ToolbarItem ("?", null, () => { //TODO: something }, 0, 0); ToolbarItems.Add (tbi2); } }
public TweetImagePage(string image) { InitializeComponent(); var item = new ToolbarItem { Text = "Done", Command = new Command(async () => await Navigation.PopModalAsync()) }; if (Device.OS == TargetPlatform.Android) item.Icon = "toolbar_close.png"; ToolbarItems.Add(item); try { MainImage.Source = new UriImageSource { Uri = new Uri(image), CachingEnabled = true, CacheValidity = TimeSpan.FromDays(3) }; } catch(Exception ex) { Debug.WriteLine("Unable to convert image to URI: " + ex); DependencyService.Get<IToast>().SendToast("Unable to load image."); } MainImage.PropertyChanged += (sender, e) => { if(e.PropertyName != nameof(MainImage.IsLoading)) return; ProgressBar.IsRunning = MainImage.IsLoading; ProgressBar.IsVisible = MainImage.IsLoading; }; }
public BlogDetailsView(FeedItem item) { BindingContext = item; var webView = new WebView { VerticalOptions = LayoutOptions.FillAndExpand, HorizontalOptions = LayoutOptions.FillAndExpand }; webView.Source = new HtmlWebViewSource { Html = item.Description }; Content = new StackLayout { Children = { webView } }; var share = new ToolbarItem { Icon = "ic_share.png", Text = "Share", Command = new Command(() => DependencyService.Get<IShare>() .ShareText("Be sure to read @shanselman's " + item.Title + " " + item.Link)) }; ToolbarItems.Add(share); }
public ToDoListPage() { BindingContext = new ToDoListViewModel(); var listView = new ListView(); listView.ItemTemplate = new DataTemplate(typeof(TextCell)); // Bindings para los items de la lista listView.SetBinding(ListView.ItemsSourceProperty, "ToDoItems"); listView.SetBinding(ListView.SelectedItemProperty, "SelectedToDoItem"); // Bindings para definir la información que se muestra por cada fila listView.ItemTemplate.SetBinding(TextCell.TextProperty, "Name"); listView.ItemTemplate.SetBinding(TextCell.DetailProperty, "Description"); var saveButton = new ToolbarItem { Text = "Save" }; var addButton = new ToolbarItem { Text = "Add" }; Content = new StackLayout { Children = { listView } }; ToolbarItems.Add(saveButton); ToolbarItems.Add(addButton); }
public GroupMatchView() { BindingContext = new GroupMatchesViewModel(); var activity = new ActivityIndicator { Color = Helpers.Color.Greenish.ToFormsColor(), IsEnabled = true }; activity.SetBinding(ActivityIndicator.IsVisibleProperty, "IsBusy"); activity.SetBinding(ActivityIndicator.IsRunningProperty, "IsBusy"); this.Groups = new ObservableCollection<GroupHelper>(); var refresh = new ToolbarItem { Command = ViewModel.LoadItemsCommand, Icon = "refresh.png", Name = "refresh", Priority = 0 }; ToolbarItems.Add(refresh); ViewModel.ItemsLoaded += new EventHandler((sender, e) => { this.Groups.Clear(); ViewModel.Result.Select(r => r.MatchDate).Distinct().ToList() .ForEach(r => Groups.Add(new GroupHelper(r))); foreach (var g in Groups) { foreach (var match in ViewModel.Result.Where(m=> m.MatchDate == g.Date)) { g.Add(match); } } }); Title = "Group Match Schedule"; var stack = new StackLayout { Orientation = StackOrientation.Vertical, Padding = new Thickness(0, 0, 0, 8) }; var listView = new ListView { IsGroupingEnabled = true, GroupDisplayBinding = new Binding("Date"), }; var viewTemplate = new DataTemplate(typeof(ScoreCell)); listView.ItemTemplate = viewTemplate; listView.ItemsSource = Groups; stack.Children.Add(activity); stack.Children.Add(listView); Content = stack; }
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; }
ToolbarItem CreateClearButton () { var clearButton = new ToolbarItem { Name = "Clear" }; clearButton.SetBinding (ToolbarItem.CommandProperty, "ClearTrackFilters"); return clearButton; }
protected override void Init () { var tbItem = new ToolbarItem { Text = "hello", Icon="wrongName" }; ToolbarItems.Add(tbItem); PushAsync (new Issue22221 ()); }
private void InitializeToolBars() { string addIcon = null; string refreshIcon = null; if (Device.OS == TargetPlatform.WinPhone) { addIcon = "Toolkit.Content/ApplicationBar.Add.png"; refreshIcon = "Toolkit.Content/ApplicationBar.Refresh.png"; } var addToolButton = new ToolbarItem("Add", addIcon, () => { var todoItem = new ToDoItem(); var todoPage = new ToDoItemXaml(); todoPage.BindingContext = todoItem; Navigation.PushAsync(todoPage); }, 0, 0); var refreshToolButton = new ToolbarItem("Refresh", refreshIcon, () => { OnAppearing(); }, 0, 0); ToolbarItems.Add(addToolButton); ToolbarItems.Add(refreshToolButton); }
public TodoListPage () { Title = AppResources.ApplicationTitle; // "Todo"; listView = new ListView { RowHeight = 40 }; listView.ItemTemplate = new DataTemplate (typeof (TodoItemCell)); listView.ItemSelected += (sender, e) => { var todoItem = (TodoItem)e.SelectedItem; // use C# localization var todoPage = new TodoItemPage(); // use XAML localization // var todoPage = new TodoItemXaml(); todoPage.BindingContext = todoItem; Navigation.PushAsync(todoPage); }; var layout = new StackLayout(); if (Device.OS == TargetPlatform.WinPhone) { // WinPhone doesn't have the title showing layout.Children.Add(new Label{Text="Todo", Font=Font.SystemFontOfSize(NamedSize.Large, FontAttributes.Bold)}); } layout.Children.Add(listView); layout.VerticalOptions = LayoutOptions.FillAndExpand; Content = layout; var tbiAdd = new ToolbarItem("Add", "plus.png", () => { var todoItem = new TodoItem(); var todoPage = new TodoItemPage(); todoPage.BindingContext = todoItem; Navigation.PushAsync(todoPage); }, 0, 0); ToolbarItems.Add (tbiAdd); var tbiSpeak = new ToolbarItem ("Speak", "chat.png", () => { var todos = App.Database.GetItemsNotDone(); var tospeak = ""; foreach (var t in todos) tospeak += t.Name + " "; if (tospeak == "") tospeak = "there are no tasks to do"; if (todos.Any ()) { var s = L10n.Localize ("SpeakTaskCount", "Number of tasks to do"); tospeak = String.Format (s, todos.Count ()) + tospeak; } DependencyService.Get<ITextToSpeech>().Speak(tospeak); }, 0, 0); ToolbarItems.Add (tbiSpeak); }
public FootballPlayerListPage() { this.BindingContext = new FootballPlayerViewModel (); Title = "Football Legends"; var create = new ToolbarItem (); create.Name = "create"; this.ToolbarItems.Add (create); create.Clicked += Create_Clicked; // create.SetBinding (ToolbarItem.CommandProperty, "CreatePlayer"); MyFootballList = new ListView (); MyFootballList.IsPullToRefreshEnabled = true; MyFootballList.Refreshing += MyFootballList_Refreshing; MyFootballList.SetBinding (ListView.ItemsSourceProperty, "Footballplayercollection"); var cell = new DataTemplate (typeof(FootballPlayerListCell)); MyFootballList.ItemTemplate = cell; MyFootballList.RowHeight = 70; MessagingCenter.Subscribe<FootballPlayerListCell>(this,"delete",(sender) => { this.BindingContext = new FootballPlayerViewModel(); FootballPlayer dat= new FootballPlayer (); MyFootballList.ItemsSource = dat.GetItems (); },null); MyFootballList.ItemSelected += (object sender, SelectedItemChangedEventArgs e) => { Navigation.PushAsync(new FootballPlayerDetailPage(e.SelectedItem)); }; this.Content = MyFootballList; }
public AccionesDia (MasterDetailPage masterDetail, int tdia, Usuario tusuario) { usuario = tusuario; dia = tdia; var guardaritem = new ToolbarItem { Text = "Guardar" }; guardaritem.Clicked += (object sender, System.EventArgs e) => { guardarAcciones(); }; ToolbarItems.Add(guardaritem); this.Title = "Acciones ahorradoras"; master = masterDetail; //End Dias cargarAcciones (); }
public TodoListXaml () { InitializeComponent (); var tbi = new ToolbarItem ("+", null, () => { var todoItem = new TodoItem(); var todoPage = new TodoItemXaml(); todoPage.BindingContext = todoItem; Navigation.PushAsync(todoPage); }, 0, 0); if (Device.OS == TargetPlatform.Android) { // BUG: Android doesn't support the icon being null tbi = new ToolbarItem ("+", "plus", () => { var todoItem = new TodoItem(); var todoPage = new TodoItemXaml(); todoPage.BindingContext = todoItem; Navigation.PushAsync(todoPage); }, 0, 0); } ToolbarItems.Add (tbi); // if (Device.OS == TargetPlatform.iOS) { // var tbi2 = new ToolbarItem ("?", null, () => { // var todos = App.Database.GetItemsNotDone(); // var tospeak = ""; // foreach (var t in todos) // tospeak += t.Name + " "; // if (tospeak == "") tospeak = "there are no tasks to do"; // App.Speech.Speak(tospeak); // }, 0, 0); // ToolbarItems.Add (tbi2); // } }
void AddToolbarItem(XToolbarItem item) { var moreOptionItem = new ActionMoreOptionItem(); var icon = item.Icon; if (!string.IsNullOrEmpty(icon.File)) { var img = new ElmSharp.Image(_moreOption); img.LoadAsync(ResourcePath.GetPath(icon.File)); moreOptionItem.Icon = img; } var text = item.Text; if (!string.IsNullOrEmpty(text)) { moreOptionItem.MainText = text; } if (item is CircleToolbarItem) { var subText = ((CircleToolbarItem)item).SubText; if (!string.IsNullOrEmpty(subText)) { moreOptionItem.SubText = subText; } } moreOptionItem.Action = () => ((IMenuItemController)item).Activate(); _moreOption.Items.Add(moreOptionItem); _toolbarItemMap[item] = moreOptionItem; }
public NoteList() { InitializeComponent(); ToolbarItem addItem = null; ToolbarItem showUndoneItem = null; ToolbarItem showAllItem = null; ToolbarItem showDoneItem = null; addItem = new ToolbarItem("Add", "add.png", () => { var note = new Note(); var notePage = new NotePage(); notePage.BindingContext = note; Navigation.PushAsync(notePage); }, ToolbarItemOrder.Primary, 0); showUndoneItem = new ToolbarItem("Not done notes", "plus", () => { listView.ItemsSource = App.Database.GetItemsNotDone(); }, ToolbarItemOrder.Secondary, 0); showDoneItem = new ToolbarItem("Done notes", "plus", () => { listView.ItemsSource = App.Database.GetItemsDone(); }, ToolbarItemOrder.Secondary, 0); showAllItem = new ToolbarItem("All", "plus", () => { listView.ItemsSource = App.Database.GetItems(); }, ToolbarItemOrder.Secondary, 0); ToolbarItems.Add(addItem); ToolbarItems.Add(showUndoneItem); ToolbarItems.Add(showDoneItem); ToolbarItems.Add(showAllItem); }
public Schedules (string title) { ToolbarItem itemPrint = new ToolbarItem { Text = "Printable web version", Order = ToolbarItemOrder.Secondary, }; ToolbarItems.Add(itemPrint); var browser = new BaseUrlWebView (); // temporarily use this so we can custom-render in iOS Title=title; var htmlSource = new HtmlWebViewSource (); htmlSource.BaseUrl = DependencyService.Get<IBaseUrl> ().Get (); string filename = ""; if (title == "Table of study schedules") filename = "schedule1.html"; else if (title == "勉強スケジュールの比較") filename = "schedule2.html"; else if (title == "100-minute lessons") filename = "schedule6.html"; else if (title == "90-minute lessons") filename = "schedule5.html"; else if (title == "80-minute lessons") filename = "schedule4.html"; else if (title == "60-minute lessons") filename = "schedule3.html"; if (Device.OS != TargetPlatform.iOS) { browser.Source = htmlSource.BaseUrl+filename; } else { browser.Source = htmlSource.BaseUrl + "/" + filename; } Content = browser; }
public void GetToolbarItem(ToolbarItem tbi, Android.Views.View view){ int res = 0; int imgRes = 0; if (tbi.Icon == null) { if (tbi.Priority == 0) res = Resource.Id.btn_textLeft; else res = Resource.Id.btn_textRight; var btn = (Android.Widget.Button)view.FindViewById(res); btn.Text = " " + tbi.Text; btn.TextSize = (float)Device.GetNamedSize (NamedSize.Small, typeof(Label)); btn.Visibility = Android.Views.ViewStates.Visible; btn.SetTextColor(Color.FromHex("218DFF").ToAndroid ()); btn.Click += (sender, ee) => { if (tbi.Command != null) tbi.Command.Execute(tbi.CommandParameter); }; } else { if (tbi.Priority == 0) res = Resource.Id.btn_imageLeft; else res = Resource.Id.btn_imageRight; imgRes = Resources.GetIdentifier(tbi.Icon.File.Split('.')[0], "drawable", MainActivity.Activity.PackageName); var imBtn = (Android.Widget.ImageButton)view.FindViewById(res); imBtn.SetImageResource(imgRes); imBtn.Visibility = Android.Views.ViewStates.Visible; imBtn.Click += (sender, ee) => { if (tbi.Command != null) tbi.Command.Execute(tbi.CommandParameter); }; } }
public LoginPageCS () { var toolbarItem = new ToolbarItem { Text = "Sign Up" }; toolbarItem.Clicked += OnSignUpButtonClicked; ToolbarItems.Add (toolbarItem); messageLabel = new Label (); usernameEntry = new Entry { Placeholder = "username" }; passwordEntry = new Entry { IsPassword = true }; var loginButton = new Button { Text = "Login" }; loginButton.Clicked += OnLoginButtonClicked; Title = "Login"; Content = new StackLayout { VerticalOptions = LayoutOptions.StartAndExpand, Children = { new Label { Text = "Username" }, usernameEntry, new Label { Text = "Password" }, passwordEntry, loginButton, messageLabel } }; }
protected override void OnAppearing() { base.OnAppearing(); ToolbarItems.Add(toolbarItem = new ToolbarItem("Save", null, Save(), 0, 0)); vm.OnAppearing(); }
public TodoListPage() { Title = "You do"; listView = new ListView(); listView.ItemTemplate = new DataTemplate(typeof(ToDoItemCell)); listView.ItemSelected += (sender, e) => { var todoItem = (TodoItem)e.SelectedItem; var todoPage = new TodoItemPage(); todoPage.BindingContext = todoItem; Navigation.PushAsync(todoPage); }; var layout = new StackLayout(); layout.Children.Add(listView); layout.VerticalOptions = LayoutOptions.FillAndExpand; Content = layout; ToolbarItem tbi = null; if (Device.OS == TargetPlatform.Android) { tbi = new ToolbarItem("+", "plus", () =>{ var todoItem = new TodoItem(); var todoPage = new TodoItemPage(); todoPage.BindingContext = todoItem; Navigation.PushAsync(todoPage); },0,0); } ToolbarItems.Add(tbi); }
public void setToolBar(){ /** * TOOLBAR RELATED CODE */ var data = DataManager.getInstance (); ToolbarItem filterTBI; ToolbarItem mapTypeTBI; filterTBI = new ToolbarItem ("", "", filterMapItems, 0, 0); mapTypeTBI = new ToolbarItem ("", "", changeMap, 0, 0); filterTBI.Icon = "Filter.png"; mapTypeTBI.Icon = "MapChange.png"; //Change map type ToolbarItems.Add (mapTypeTBI); if (data.isNetworked()) { ToolbarItem refreshTBI; refreshTBI = new ToolbarItem ("", "", refreshData, 0, 0); refreshTBI.Icon = "Refresh.png"; ToolbarItems.Add (refreshTBI); } ToolbarItems.Add (filterTBI); }
public evaluacion (MasterDetailPage masterDetail, Usuario tusuario) { master = masterDetail; usuario = tusuario; var guardaritem = new ToolbarItem { Text = "Guardar" }; guardaritem.Clicked += (object sender, System.EventArgs e) => { guardarEvaluacion(); }; //ToolbarItems.Add(new ToolbarItem(){Icon="pazosicon.png"}); ToolbarItems.Add(guardaritem); this.Title = "Evaluación del día"; DateTime fecha = DateTime.Now; int dia = (int)fecha.DayOfWeek; if (dia == 0) { dia = 7; } diaselected= dia; dibuja (dia); }
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 void AddRePostToolbar() { Xamarin.Forms.ToolbarItem toolbarItem = new Xamarin.Forms.ToolbarItem() { Text = Language.dang_lai }; toolbarItem.Clicked += async(o, a) => { loadingPopup.IsVisible = true; ApiResponse apiResponse = await ApiHelper.Put(ApiRouter.LIQUIDATIONTODAY_REPOST + "/" + viewModel.LiquidationModel.Id, null, true); if (apiResponse.IsSuccess) { loadingPopup.IsVisible = false; LblStatus.Text = Language.dang_ban; this.ToolbarItems.Remove(toolbarItem); MessagingCenter.Send <AddToDayPage>(this, "OnSaveItem"); MessagingCenter.Send <AddToDayPage, Guid>(this, "OnSaveItem", viewModel.LiquidationModel.Id); ToastMessageHelper.ShortMessage(Language.dang_thanh_cong); } else { loadingPopup.IsVisible = false; ToastMessageHelper.ShortMessage(Language.loi_vui_long_thu_lai); } }; this.ToolbarItems.Add(toolbarItem); }
public TabPage() { BackgroundColor = Color.FromHex("#044A0C"); Title = "North Lakes"; total = new ToolbarItem { Name = "Welcome Ross", }; this.ToolbarItems.Add(total); var listsPage = new ShoppingListsTest(); listsPage.Title = "Lists"; this.Children.Add(listsPage); var specialsPage = new SpecialsPage(); specialsPage.Title = "Specials"; this.Children.Add(specialsPage); var shoppingcartPage = new ShoppingCart(); shoppingcartPage.Title = "Basket"; this.Children.Add(shoppingcartPage); var morePage = new MoreNav(); morePage.Title = "More"; this.Children.Add(morePage); }
public static ToolbarItem[] ToolbarBtn() { var MenuBtn = new ToolbarItem("منوی اصلی", "Menu.png", () => { if (!HomePage.MasterPage.IsVisible) { HomePage.MasterPage.IsVisible = true; FirstPage.menuPage.Menu.SelectedItem = null; FirstPage.menuPage.SpecialMenu.SelectedItem = null; HomePage.doSmoothOpen(); } else HomePage.doSmoothClose(); }); toolbarItems[0] = MenuBtn; var ShortCut = new ToolbarItem("میانبر", "Shortcut.png", () => { if (!HomePage.ShortCutPage.IsVisible) { HomePage.doShortcutSmoothOpen(); HomePage.ShortCutPage.IsVisible = true; FirstPage.menuPage.ShortcutMenu.SelectedItem = null; } else HomePage.doShortcutSmoothClose(); }); toolbarItems[1] = ShortCut; return toolbarItems; }
protected override void OnAppearing() { base.OnAppearing(); vm.PopulateReminderList(); listView.ItemsSource = vm.ReminderList; ToolbarItems.Add(toolBarItem = new ToolbarItem("Add", null, Save(), 0, 0)); }
void RemoveToolbarITem(XToolbarItem item) { if (_toolbarItemMap.TryGetValue(item, out var moreOptionItem)) { _moreOption?.Items.Remove(moreOptionItem); _toolbarItemMap.Remove(item); } }
public void AddDeleteToolbar() { Xamarin.Forms.ToolbarItem deleteToolBar = new Xamarin.Forms.ToolbarItem(); deleteToolBar.Text = "Xóa"; deleteToolBar.Priority = 0; deleteToolBar.Order = ToolbarItemOrder.Default; deleteToolBar.Clicked += DeleteToolbar_Clicked; this.ToolbarItems.Add(deleteToolBar); }
public ProjectList () { Title = "Project List"; var tbi = new ToolbarItem(); tbi.Text = "Add"; tbi.Clicked += Add_Clicked; ToolbarItems.Add(tbi); }
public MyBets() { // Create the ListView. listView = new ListView(); // Define template for displaying each item. listView.ItemTemplate = new DataTemplate(typeof(BetCell)); //Define action for item selected listView.ItemSelected += (sender, e) => { var BetObject = (Bet)e.SelectedItem; var BetPage = new BetPage (); BetPage.BindingContext = BetObject; ((App)App.Current).ResumeAtBetId = BetObject.ID; Navigation.PushAsync (BetPage); }; // Accomodate iPhone status bar. this.Padding = new Thickness(10, Device.OnPlatform(20, 0, 0), 10, 5); listView.HasUnevenRows = true; var tbi = new ToolbarItem("+", null, async () => { var action = await DisplayActionSheet ("Add Bet", "Cancel", null, "Manually", "Picture"); switch (action){ case "Manually": { var BetObject = new Bet(); var BetPage = new BetPage(); BetPage.BindingContext = BetObject; Navigation.PushAsync(BetPage); break; } case "Picture": { Navigation.PushAsync( new CameraView()); break; } } } ); this.ToolbarItems.Add(tbi); listView.IsPullToRefreshEnabled = true; listView.Refreshing += ListView_Refreshing; // Build the page. this.Content = new StackLayout { Children = { listView } }; }
public QuestionListPage() { Title = "Question"; NavigationPage.SetHasNavigationBar (this, true); listView = new ListView { RowHeight = 40, ItemTemplate = new DataTemplate (typeof(QuestionCell)) }; listView.ItemSelected += (sender, e) => { var question = (Question)e.SelectedItem; var questionDetailPage = new QuestionDetailPage (); questionDetailPage.BindingContext = question; Navigation.PushAsync (questionDetailPage); }; /* listView.ItemsSource = new Question [] { new Question {QuestionText = "Question 1"}, new Question {QuestionText = "Question 2"}, new Question {QuestionText = "Question 3"}, new Question {QuestionText = "Question 4"}, new Question {QuestionText = "Question 5"}, new Question {QuestionText = "Question 6"}, }; */ var layout = new StackLayout (); layout.Children.Add (listView); layout.VerticalOptions = LayoutOptions.FillAndExpand; Content = layout; ToolbarItem tbi = null; if (Device.OS == TargetPlatform.iOS) { tbi = new ToolbarItem ("+", null, () => { var questionItem = new Question (); var questionDetailPage = new QuestionDetailPage (); questionDetailPage.BindingContext = questionItem; Navigation.PushAsync (questionDetailPage); }, 0, 0); } if (Device.OS == TargetPlatform.Android) { // BUG: Android doesn't support the icon being null tbi = new ToolbarItem ("+", "plus", () => { var questionItem = new Question (); var questionDetailPage = new QuestionDetailPage (); questionDetailPage.BindingContext = questionItem; Navigation.PushAsync (questionDetailPage); }, 0, 0); } ToolbarItems.Add (tbi); }
public HomePage() { this.Title = "Note Taker 12"; // Create and initialize ListView. ListView listView = new ListView { ItemsSource = App.NoteFolder.Notes, ItemTemplate = new DataTemplate(typeof(TextCell)), VerticalOptions = LayoutOptions.FillAndExpand }; listView.ItemTemplate.SetBinding(TextCell.TextProperty, "Identifier"); // Handle item selection for editing and deleting. listView.ItemSelected += (sender, args) => { if (args.SelectedItem != null) { // Deselect the item. listView.SelectedItem = null; // Navigate to NotePage. Note note = (Note)args.SelectedItem; this.Navigation.PushAsync(new NotePage(note, true)); } }; // Create and initialize ToolbarItem. ToolbarItem addNewItem = new ToolbarItem { Name = "Add Note", Icon = Device.OnPlatform("new.png", "ic_action_new.png", "Images/add.png"), Order = ToolbarItemOrder.Primary }; addNewItem.Activated += (sender, args) => { // Create unique filename. DateTime datetime = DateTime.UtcNow; string filename = datetime.ToString("yyyyMMddHHmmssfff") + ".note"; // Navigate to new NotePage. Note note = new Note(filename); this.Navigation.PushAsync(new NotePage(note)); }; this.ToolbarItems.Add(addNewItem); // Assemble page. this.Content = listView; CheckForResumedStartup(); }
public HomePage(string title) { BackgroundColor = Color.Gray.WithLuminosity(.9); Title = title; Padding = 0; PopupButton = new ToolbarItem { Text = "Show Popup", Priority = 0 }; ToolbarItems.Add(PopupButton); PopupButton.Clicked += ((object sender, EventArgs e) => { if (!PopupContent.PopupVisible) { #region popup content //optional remove popup toolbaritem from navigation bar ToolbarItems.Remove(PopupButton); TableRoot = new TableRoot(); TableView = new TableView(TableRoot) { Intent = TableIntent.Data, HasUnevenRows = false }; TableSection = new TableSection(""); TableRoot.Add(TableSection); for (var i = 0; i < 20; i++) { TableSection.Add(new SwitchCell { Text = "Switch Cell #" + i }); } //scale the size of the modal popup min=.25 max=1 default=.80 optional title //if the size=1 the dialog will fill the content area like a sheet window PopupContent.ShowPopup(TableView, 1, modal: true, title: "Perfect Popup "); foreach (var cell1 in TableSection) { var cell = (SwitchCell)cell1; cell.OnChanged += ((cellsender, cellevent) => { PopupContent.PopupChanged = true; }); } #endregion } else { PopupContent.DismisPopup(); } }); }
private static Action <IShadow, ImageSource> GetSetAction(IShadow <Xamarin.Forms.Element> shadow) { return(shadow.Item switch { Xamarin.Forms.Button _ => ImageSourceMappers.Button, Xamarin.Forms.Image _ => ImageSourceMappers.Image, Xamarin.Forms.ToolbarItem _ => ImageSourceMappers.ToolbarItem, Xamarin.Forms.ImageButton _ => ImageSourceMappers.ImageButton, Xamarin.Forms.ImageCell _ => ImageSourceMappers.ImageCell, _ => throw new ArgumentException() });
public ToolbarItemEventArgs(ToolbarItem item) { ToolbarItem = item; }
public ToolbarItemEvents(ToolbarItem This) : base(This) { this.This = This; }
public static ToolbarItemEvents Events(this ToolbarItem This) { return(new ToolbarItemEvents(This)); }
public ToolbarItemHandler(NativeComponentRenderer renderer, XF.ToolbarItem toolbarItemControl) : base(renderer, toolbarItemControl) { ToolbarItemControl = toolbarItemControl ?? throw new ArgumentNullException(nameof(toolbarItemControl)); Initialize(renderer); }