• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C# Forms.ToolbarItem类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中Xamarin.Forms.ToolbarItem的典型用法代码示例。如果您正苦于以下问题:C# ToolbarItem类的具体用法?C# ToolbarItem怎么用?C# ToolbarItem使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



ToolbarItem类属于Xamarin.Forms命名空间,在下文中一共展示了ToolbarItem类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: ToDoListPage

        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);
        }
开发者ID:fferegrino,项目名称:mvvm,代码行数:28,代码来源:ToDoListPage.cs


示例2: GetToolbarItem

		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);
				};
			}
		}
开发者ID:luis-villase,项目名称:MxApp,代码行数:33,代码来源:NavigationPageRenderer.cs


示例3: TodoListPage

		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);


		}
开发者ID:ZaK14120,项目名称:xamarin-forms-samples,代码行数:60,代码来源:TodoListPage.cs


示例4: TweetImagePage

        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;
                };
        }
开发者ID:RobGibbens,项目名称:app-evolve,代码行数:35,代码来源:TweetImagePage.xaml.cs


示例5: LoginPageCS

		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
				}
			};
		}
开发者ID:ChandrakanthBCK,项目名称:xamarin-forms-samples,代码行数:33,代码来源:LoginPageCS.cs


示例6: Schedules

		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;
		}
开发者ID:kimuraeiji214,项目名称:Keys,代码行数:35,代码来源:Schedules.cs


示例7: AccionesDia

		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 ();




		}
开发者ID:jupabequi,项目名称:COLPLATP12,代码行数:30,代码来源:AccionesDia.xaml.cs


示例8: InitializeToolBars

        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);
        }
开发者ID:fellipetenorio,项目名称:mobile-services-samples,代码行数:27,代码来源:ToDoListXaml.xaml.cs


示例9: ToolbarBtn

        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;
        }
开发者ID:mxmaa64,项目名称:Calender,代码行数:35,代码来源:App.cs


示例10: TodoListXaml

		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);
//			}
		}
开发者ID:JeffHarms,项目名称:xamarin-forms-samples-1,代码行数:33,代码来源:TodoListXaml.xaml.cs


示例11: OnAppearing

		protected override void OnAppearing()
		{
			base.OnAppearing();
			ToolbarItems.Add(toolbarItem = new ToolbarItem("Save", null, Save(), 0, 0));

			vm.OnAppearing();
		}
开发者ID:rangeogx1923,项目名称:AndroidWear,代码行数:7,代码来源:EditReminderPage.xaml.cs


示例12: setToolBar

		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);


		}
开发者ID:r0345,项目名称:EIMA,代码行数:29,代码来源:MapPage.cs


示例13: GroupMatchView

        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;
        }
开发者ID:AjourMedia,项目名称:FootballTournament2014,代码行数:60,代码来源:GroupMatchView.cs


示例14: evaluacion

		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);

		}
开发者ID:jupabequi,项目名称:COLPLATP12,代码行数:29,代码来源:evaluacion.xaml.cs


示例15: TodoListPage

        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);
        }
开发者ID:SindhoojaMullapudi,项目名称:UDo,代码行数:34,代码来源:TodoListPage.cs


示例16: BlogDetailsView

        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);
        }
开发者ID:jmielczarkowski,项目名称:Hanselman.Forms,代码行数:29,代码来源:BlogDetailsView.cs


示例17: CreateClearButton

		ToolbarItem CreateClearButton ()
		{
			var clearButton = new ToolbarItem { Name = "Clear" };
			clearButton.SetBinding (ToolbarItem.CommandProperty, "ClearTrackFilters");

			return clearButton;
		}
开发者ID:vgvassilev,项目名称:couchbase-connect-14,代码行数:7,代码来源:FiltersView.cs


示例18: Init

		protected override void Init ()
		{
			var tbItem = new ToolbarItem { Text = "hello", Icon="wrongName" };
			ToolbarItems.Add(tbItem);

			PushAsync (new Issue22221 ());
		}
开发者ID:Costo,项目名称:Xamarin.Forms,代码行数:7,代码来源:Issue2222.cs


示例19: TabPage

        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);
        }
开发者ID:boxuanzhang,项目名称:woolies,代码行数:30,代码来源:TabPage.cs


示例20: RssFeedView2

        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;
        }
开发者ID:jeffbmiller,项目名称:RSSFeeds,代码行数:31,代码来源:RssFeedView2.cs



注:本文中的Xamarin.Forms.ToolbarItem类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# Forms.View类代码示例发布时间:2022-05-26
下一篇:
C# Forms.Thickness类代码示例发布时间:2022-05-26
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap