当前位置: 首页>>代码示例>>C#>>正文


C# Forms.ContentPage类代码示例

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


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

示例1: CreatePage

		ContentPage CreatePage (Color backgroundColor)
		{
			_index++;
			var button = new Button () {
				Text = "next Page",
			};
			button.Clicked += (sender, e) => {
				var page = CreatePage (Color.Green);
				_navigationPage.PushAsync (page);
			};

			var contentPage = new ContentPage () {
				Content = new StackLayout () {
					BackgroundColor = backgroundColor,
					VerticalOptions = LayoutOptions.Fill,
					Children = {
						new Label () {
							Text = "page " + _index,
						},

					}
				}
			};
			return contentPage;
		}
开发者ID:DevinvN,项目名称:TwinTechsFormsLib,代码行数:25,代码来源:NavigationPageInPage.xaml.cs

示例2: App

        public App()
        {
            // The root page of your application
            MainPage = new ContentPage {

            };
        }
开发者ID:hdh13,项目名称:TrashToTreasure,代码行数:7,代码来源:ToT.cs

示例3: App

        public App()
        {
            Picker pickerArrival = new Picker ();
            pickerArrival.Items.Add ("Android");
            pickerArrival.Items.Add ("iOS");
            pickerArrival.Items.Add ("Windows Phone");

            Button bt = new Button {
                Text = "Select OS",
            };

            bt.Clicked += (e, sender) => {
                Console.WriteLine ("Selected item: " + pickerArrival.Items [pickerArrival.SelectedIndex] +
                " - index: " + pickerArrival.SelectedIndex);
            };

            // The root page of your application
            MainPage = new ContentPage {
                Content = new StackLayout {
                    VerticalOptions = LayoutOptions.Center,
                    Children = {
                        pickerArrival,
                        bt
                    }
                }
            };
        }
开发者ID:NouriTj,项目名称:Xamarin,代码行数:27,代码来源:CustomPiker.cs

示例4: CreateMenuPage

		protected void CreateMenuPage(string menuPageTitle)
		{
			var _menuPage = new ContentPage ();
			_menuPage.Title = menuPageTitle;
			var listView = new ListView();

			listView.ItemsSource = new string[] { "Contacts", "Quotes", "Modal Demo" };

			listView.ItemSelected += async (sender, args) =>
			{

				switch ((string)args.SelectedItem) {
				case "Contacts":
					_tabbedNavigationPage.CurrentPage = _contactsPage;
					break;
				case "Quotes":
					_tabbedNavigationPage.CurrentPage = _quotesPage;
					break;
				case "Modal Demo":
                    var modalPage = FreshPageModelResolver.ResolvePageModel<ModalPageModel>();
					await PushPage(modalPage, null, true);
					break;
				default:
				break;
				}

				IsPresented = false;
			};

			_menuPage.Content = listView;

			Master = new NavigationPage(_menuPage) { Title = "Menu" };
		}
开发者ID:gaoxl,项目名称:FreshMvvm,代码行数:33,代码来源:CustomImplementedNav.cs

示例5: ApplicationProviderMock

 public ApplicationProviderMock()
 {
     MainPage = new ContentPage()
     {
         Title = "MainPage"
     };
 }
开发者ID:Citringo,项目名称:Prism,代码行数:7,代码来源:ApplicationProviderMock.cs

示例6: changeVisiblePage

		public void changeVisiblePage(ContentPage page)
		{
			NavigationPage navPage = new NavigationPage(page);
			navPage.BarBackgroundColor = Theme.getBackgroundColor ();
			navPage.BarTextColor = Theme.getTextColor();
			App.Current.MainPage = navPage;
		}
开发者ID:bsd5129,项目名称:LionHub,代码行数:7,代码来源:TabMenu.xaml.cs

示例7: App

        public App()
        {
            Button showInfo = new Button { Text = "Info" };
            showInfo.Clicked += (s, e) => ShowToast(ToastNotificationType.Info);
           
            Button showSuccess = new Button { Text = "Success" };
            showSuccess.Clicked += (s, e) => ShowToast(ToastNotificationType.Success);

            Button showWarning = new Button { Text = "Warning" };
            showWarning.Clicked += (s, e) => ShowToast(ToastNotificationType.Warning);

            Button showError = new Button { Text = "Error" };
            showError.Clicked += (s, e) => ShowToast(ToastNotificationType.Error);

            // The root page of your application
            MainPage = new ContentPage
            {
                Content = new StackLayout
                {
                    VerticalOptions = LayoutOptions.Center,
                    Children = {
                        showInfo,
                        showSuccess,
                        showWarning,
                        showError
					}
                }
            };
            

        }
开发者ID:adamped,项目名称:Toasts.Forms.Plugin,代码行数:31,代码来源:App.cs

示例8: LoginXaml

		public LoginXaml (ContentPage parent)
		{
			InitializeComponent ();	
			viewModel = new LoginViewModel ();
			this.parent = parent;
			BindingContext = viewModel;
		}
开发者ID:BobSchlitten,项目名称:xamarin-forms-samples,代码行数:7,代码来源:LoginXaml.xaml.cs

示例9: GetMainPage

        public static Page GetMainPage()
        {
            ContentPage contentPage = new ContentPage();

            //Padding agrega un margen al contenido
            //Device.OnPlatform permite modificar este margen dependiendo de la plataforma IOS, Android y Windows Phone
            //Para saber más sobe Device.OnPlatform revisa
            contentPage.Padding = new Thickness (5, Device.OnPlatform (20, 5, 5), 5, 5);

            //Stacklayout permite apilar los controles verticalmente
            StackLayout stackLayout = new StackLayout
            {
                Children =
                {
                    new Label
                    {
                        Text = "Blue",
                        TextColor = Color.Blue
                    },
                    new Label
                    {
                        Text = "Silver",
                        TextColor = Color.Silver
                    },
                    new Label
                    {
                        Text = "Black",
                        TextColor = Color.Black
                    }
                }
            };

            contentPage.Content = stackLayout;
            return contentPage;
        }
开发者ID:narno67,项目名称:Xamarin,代码行数:35,代码来源:App.cs

示例10: MainPage

        public MainPage()
        {
            var menuPageContent = new StackLayout {
                VerticalOptions = LayoutOptions.Center,
            };

            menuPageContent.Children.Add (new Label {
                Text = "Menu Drawer",
                TextColor = Color.Black,
                HorizontalOptions = LayoutOptions.Center
            });

            var menuPage = new ContentPage { Content = menuPageContent, Title = "Menu Drawer"
            };

            Master = menuPage;

            var detailPageContent = new StackLayout { VerticalOptions = LayoutOptions.Center };

            detailPageContent.Children.Add (new Label {
                Text = "Landing Page",
                TextColor = Color.Black,
                HorizontalOptions = LayoutOptions.Center
            });

            var detailPage = new ContentPage { Content = detailPageContent, Title = "Home" };

            Detail = new NavigationPage (detailPage);
        }
开发者ID:paulpatarinski,项目名称:XF_AppCompat,代码行数:29,代码来源:MainPage.cs

示例11: GetCategoryCell

		Cell GetCategoryCell (string cat) {
			var cell = new TextCell {Text = cat};
			cell.Tapped += (sender, ea) => {;
				var category = cat;

				var tableView = new TableView ();
				var root = new TableRoot (category);
				var section = new TableSection ();
				section.Add (exampleInfoList
					.Where (e => e.Category == category)
					.OrderBy (e => e.Title)
					.Select (e => GetGraphCell(e.Title) ));
				root.Add (section);
				tableView.Root = root;

				var contentPage = new ContentPage {
					Title = category,
					Content = new StackLayout {
						Children = {tableView}
					}
				};

				Navigation.PushAsync (contentPage);
			};
			return cell;
		}
开发者ID:BobSchlitten,项目名称:xamarin-forms-samples,代码行数:26,代码来源:ExampleList.cs

示例12: ExecuteLoadItemsCommand

        private async Task ExecuteLoadItemsCommand()
        {
            if (IsBusy)
                return;

            IsBusy = true;

            try{
                var httpClient = new HttpClient();
                var feed = "http://api.espn.com/v1/sports/soccer/fifa.world/teams?apikey=trs58u4j7gw4aat7ck8dsmgc";
                var responseString = await httpClient.GetStringAsync(feed);

                Teams.Clear();
                var items = await ParseFeed(responseString);
                foreach (var item in items.OrderBy(t => t.Name))
                {
                    Teams.Add(item);
                }
                keepTeams = Teams.ToList();
            } catch (Exception) {
                var page = new ContentPage();
                page.DisplayAlert ("Error", "Unable to load teams.", "OK", null);
            }

            IsBusy = false;
        }
开发者ID:AjourMedia,项目名称:FootballTournament2014,代码行数:26,代码来源:TeamsViewModel.cs

示例13: App

        public App()
        {
            var mainLabel = new Label
            {
                XAlign = TextAlignment.Center,
                Text = "Starting test run..."
            };
            var testsLabel = new Label
            {
                XAlign = TextAlignment.Center,
                Text = ""
            };

            // The root page of your application
            MainPage = new ContentPage
            {
                Content = new StackLayout
                {
                    VerticalOptions = LayoutOptions.Center,
                    Children = {
						mainLabel, testsLabel
					}
                }
            };

            try
            {
                runner = new XFormsPortableRunner(mainLabel, testsLabel, Xamarin.Forms.Device.BeginInvokeOnMainThread);
            }
            catch(Exception e)
            {
                testsLabel.Text += e.ToString();
            }
            TestSdk(testsLabel);
        }
开发者ID:rajdotnet,项目名称:aws-sdk-net,代码行数:35,代码来源:App.cs

示例14: ExecuteLoadStatsCommand

		public async Task ExecuteLoadStatsCommand()
		{
			if (IsBusy)
				return;

			IsBusy = true;

			try
			{
				var adminManager = new AdminManager(Settings.AccessToken);

				Names.Clear();
				foreach(var name in await adminManager.PopularNames())
				{
					Names.Add(name);
				}
			}
			catch (Exception ex)
			{
				var page = new ContentPage();
				page.DisplayAlert("Error", "Unable to load.", "OK"); ;
			}
			finally
			{
				IsBusy = false;
			}
		}
开发者ID:richardboegli,项目名称:KinderChat,代码行数:27,代码来源:StatisticsNamesViewModel.cs

示例15: App

        public App()
        {
            NavigationPage _nav = null;

            var listView = new ListView ();

            listView.ItemsSource = _builder.BuildSamples ();
            listView.ItemTemplate = new DataTemplate (typeof(TextCell));
            listView.ItemTemplate.SetBinding (TextCell.TextProperty, "Name");
            listView.ItemTemplate.SetBinding (TextCell.DetailProperty, "Name");

            listView.ItemSelected += async (sender, e) => {
                var sample = (ViewSample)e.SelectedItem;
                var samplePage = new ViewSamplePage(sample);
                await _nav.PushAsync(samplePage);
            };

            var root = new ContentPage {
                Title = "Common Controls",
                Content = listView
            };

            _nav = new NavigationPage (root);

            // The root page of your application
            MainPage = _nav;
        }
开发者ID:ardiprakasa,项目名称:create-cross-platform-mobile-apps-with-xamarinforms,代码行数:27,代码来源:XamarinFormsViews.cs


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