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

C# Forms.StackLayout类代码示例

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

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



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

示例1: MenuCell

        public MenuCell()
        {
            image = new Image {
                HeightRequest = 20,
                WidthRequest = 20,
            };

            image.Opacity = 0.5;
               // image.SetBinding(Image.SourceProperty, ImageSrc);

            label = new Label
            {

                YAlign = TextAlignment.Center,
                TextColor = Color.Gray,
            };

            var layout = new StackLayout
            {
               // BackgroundColor = Color.FromHex("2C3E50"),
                BackgroundColor = Color.White,

                Padding = new Thickness(20, 0, 0, 0),
                Orientation = StackOrientation.Horizontal,
                Spacing = 20,
                //HorizontalOptions = LayoutOptions.StartAndExpand,
                Children = { image,label }
            };
            View = layout;
        }
开发者ID:segmond,项目名称:CPXamarin,代码行数:30,代码来源:MenuCell.cs


示例2: GuidePageView

        public GuidePageView()
        {
            this.BackgroundColor = Color.Black;

            var layout = new StackLayout{ Padding = new Thickness (5, 10) };
            this.Title = "Help Page";
            layout.Children.Add (new Label {
                Text = "This will contain some helpful information.",
                FontSize = 30,
                TextColor = Color.White
            });

            var browser = new WebView ();
            var htmlSource = new HtmlWebViewSource ();
            htmlSource.Html = @"<iframe width=""300"" height=""200"" src=""https://www.youtube.com/embed/Y7bxlR-MxxM"" frameborder=""0"" allowfullscreen></iframe>";
            browser.Source = htmlSource;
            browser.HeightRequest = 215.0;
            browser.WidthRequest = 320.0;

            layout.Children.Add (browser);
            layout.Children.Add (
                new Button () {Text = "I'm ready to start",
                    Command = new Command (() => this.Navigation.PushAsync (new MainListViews ()))
                });
            this.Content = layout;
        }
开发者ID:adrianbrink,项目名称:be-my-guide,代码行数:26,代码来源:GuidePageView.cs


示例3: OnAppearing

        protected override void OnAppearing()
        {
            base.OnAppearing ();

            var goXamlButton = new Button { Text = " Go With Xaml " , TextColor= Color.Black, BackgroundColor= Color.Gray};
            goXamlButton.Clicked += (sender, e) => {
                Navigation.PushAsync (new MenuPage());
            };

            var goCodeButton = new Button { Text = " Go With Code Only " , TextColor= Color.Black, BackgroundColor= Color.Gray };
            goCodeButton.Clicked += (sender, e) => {
                Navigation.PushAsync (new TodoListPage());
            };
            // The root page of your application
            Content = new StackLayout {
                VerticalOptions = LayoutOptions.Center,
                Children = {
                    new Label {
                        XAlign = TextAlignment.Center,
                        Text = "Welcome " + ((UserProfile)BindingContext).Name
                    },
                    goCodeButton,
                    goXamlButton
                }
            };
        }
开发者ID:dhinesh886,项目名称:XamarinPOCRepo,代码行数:26,代码来源:WelcomePage.xaml.cs


示例4: MenuPage

		public MenuPage ()
		{
			Title = "LoginPattern";
			Icon = "slideout.png";

			var section = new TableSection () {
				new TextCell {Text = "Sessions"},
				new TextCell {Text = "Speakers"},
				new TextCell {Text = "Favorites"},
				new TextCell {Text = "Room Plan"},
				new TextCell {Text = "Map"},
			};

			var root = new TableRoot () {section} ;

			tableView = new TableView ()
			{ 
				Root = root,
				Intent = TableIntent.Menu,
			};

			var logoutButton = new Button { Text = "Logout" };
			logoutButton.Clicked += (sender, e) => {
				App.Current.Logout();
			};

			Content = new StackLayout {
				BackgroundColor = Color.Gray,
				VerticalOptions = LayoutOptions.FillAndExpand,
				Children = {
					tableView, 
					logoutButton
				}
			};
		}
开发者ID:ZaK14120,项目名称:xamarin-forms-samples,代码行数:35,代码来源:MenuPage.cs


示例5: ListItemTemplate

		public ListItemTemplate ()
		{
			var photo = new Image { HeightRequest = 44, WidthRequest = 44 };
			photo.SetBinding (Image.SourceProperty, "Photo");

			var nameLabel = new Label { 
				VerticalTextAlignment = TextAlignment.Center,
				FontAttributes = FontAttributes.None,
				FontSize = Device.GetNamedSize (NamedSize.Medium, typeof(Label)),
			};

			nameLabel.SetBinding (Label.TextProperty, "Name");

			var titleLabel = new Label { 
				VerticalTextAlignment = TextAlignment.Center,
				FontAttributes = FontAttributes.None,
				FontSize = Device.GetNamedSize (NamedSize.Micro, typeof(Label)),
			};

			titleLabel.SetBinding (Label.TextProperty, "Title");

			var information = new StackLayout {
				Padding = new Thickness (5, 0, 0, 0),
				VerticalOptions = LayoutOptions.StartAndExpand,
				Orientation = StackOrientation.Vertical,
				Children = { nameLabel, titleLabel }
			};

			View = new StackLayout {
				Orientation = StackOrientation.Horizontal,
				Children = { photo, information }
			};
		}
开发者ID:RickySan65,项目名称:xamarin-forms-samples,代码行数:33,代码来源:TableItems.cs


示例6: Login

        public Login()
        {
            Entry usuario = new Entry { Placeholder = "Usuario" };
            Entry clave = new Entry { Placeholder = "Clave", IsPassword = true };

            Button boton = new Button {
                Text = "Login",
                TextColor = Color.White,
                BackgroundColor = Color.FromHex ("77D065")
            };

            boton.Clicked += (sender, e) => {

            };

            //Stacklayout permite apilar los controles verticalmente
            StackLayout stackLayout = new StackLayout
            {
                Spacing = 20,
                Padding = 50,
                VerticalOptions = LayoutOptions.Center,
                Children =
                {
                    usuario,
                    clave,
                    boton
                }
            };

            //Como esta clase hereda de ContentPage, podemos usar estas propiedades directamente
            this.Content = stackLayout;
            this.Padding = new Thickness (5, Device.OnPlatform (20, 5, 5), 5, 5);
        }
开发者ID:narno67,项目名称:Xamarin,代码行数:33,代码来源:Login.cs


示例7: CreateControls

		void CreateControls()
		{
			_picker = new DatePicker { Format = "D" };

			_manExpense = new Entry { Placeholder = "Exemple : 0,00", Keyboard = Keyboard.Numeric };
			_manExpense.TextChanged += numberEntry_TextChanged;
			_womanExpense = new Entry { Placeholder = "Exemple : 0,00", Keyboard = Keyboard.Numeric };
			_womanExpense.TextChanged += numberEntry_TextChanged;
			_details = new Editor { BackgroundColor = AppColors.Gray.MultiplyAlpha(0.15d), HeightRequest = 150 };

			Content = new StackLayout
				{ 
					Padding = new Thickness(20),
					Spacing = 10,
					Children =
						{
							new Label { Text = "Date" },
							_picker,
							new Label { Text = "Man expense" },
							_manExpense,
							new Label { Text = "Woman expense" },
							_womanExpense,
							new Label { Text = "Informations" },
							_details
						}
					};
		}
开发者ID:Benesss,项目名称:ExpenseForms,代码行数:27,代码来源:AddPage.cs


示例8: CreateMiddleLayout

		static StackLayout CreateMiddleLayout()
		{

			//			var preBlank = new Label {
			//				Text = "",
			//				FontSize = 11
			//			};
			var preAbv = new Label {
				Text = "Abv",
				FontSize = 11,
				FontAttributes = FontAttributes.Bold
			};

			var preIbu = new Label {
				Text = "Ibu",
				FontSize = 11,
				FontAttributes = FontAttributes.Bold
			};


			var ctrlayout = new StackLayout()
			{
				//HorizontalOptions = LayoutOptions.Start,
				VerticalOptions = LayoutOptions.Center,
				Orientation = StackOrientation.Vertical,
				Children = {preIbu, preAbv }
			};

			return ctrlayout;
		}
开发者ID:fabianwilliams,项目名称:JailBreakMobilePublic,代码行数:30,代码来源:ListOfBeerCell2.cs


示例9: MenuPage

		public MenuPage ()
		{
			Icon = "settings.png";
			Title = "Gráficos"; // The Title property must be set.
			BackgroundColor = Color.FromHex ("333333");

			Menu = new MenuListView ();

			var menuLabel = new ContentView {
				Padding = new Thickness (10, 36, 0, 5),
				Content = new Label {
					TextColor = Color.FromHex ("AAAAAA"),
					Text = "Gráficos", 
				}
			};

			var layout = new StackLayout { 
				Spacing = 0, 
				VerticalOptions = LayoutOptions.FillAndExpand
			};
			layout.Children.Add (menuLabel);
			layout.Children.Add (Menu);

			Content = layout;
		}
开发者ID:raynerhmc,项目名称:XamarinFormsPesquera,代码行数:25,代码来源:MenuPage.cs


示例10: Setting

        public Setting()
        {
            var stack = new StackLayout
            {
                Orientation = StackOrientation.Vertical,
                Spacing = 10
            };

            var stack2 = new StackLayout
            {
                Orientation = StackOrientation.Vertical,
                VerticalOptions = LayoutOptions.FillAndExpand,
                Spacing = 10,
                Padding = 10
            };

            var about = new Label
            {
                Font = Font.SystemFontOfSize(NamedSize.Medium),
                Text = "Setting",
                LineBreakMode = LineBreakMode.WordWrap
            };

            stack2.Children.Add(about);
            stack.Children.Add(new ScrollView { VerticalOptions = LayoutOptions.FillAndExpand, Content = stack2 });
            Content = stack;

        }
开发者ID:XnainA,项目名称:InsideInning,代码行数:28,代码来源:Setting.cs


示例11: BookChapterLabel

        public BookChapterLabel()
        {
            this.Orientation = StackOrientation.Horizontal;
            this.HorizontalOptions = LayoutOptions.FillAndExpand;
            this.VerticalOptions = LayoutOptions.StartAndExpand;

            // Book & chapter layout
            StackLayout bookChapter = new StackLayout
            {
                Orientation = StackOrientation.Horizontal,
                Spacing = 0,
                HorizontalOptions = LayoutOptions.CenterAndExpand
            };

            this.chapterLabel = new ChapterLabel();
            bookChapter.Children.Add(chapterLabel);

            this.bookLabel = new BookLabel();
            bookChapter.Children.Add(this.bookLabel);

            // Main layout
            this.settingsLabel = new SettingsLabel();
            this.Children.Add(this.settingsLabel);

            this.Children.Add(bookChapter);

            this.verseLabel = new VerseLabel();
            this.Children.Add(this.verseLabel);
        }
开发者ID:copticgem,项目名称:inter,代码行数:29,代码来源:BookChapterLabel.cs


示例12: CreateNewCountLayout

        public StackLayout CreateNewCountLayout()
        {
            var lblCount = new Label()
            {
                HorizontalOptions = LayoutOptions.Start,
                FontSize = 24,
            };
            lblCount.SetBinding(Label.TextProperty, new Binding("Count" , stringFormat: "#{0}"));

            var lblPrice = new Label()
            {
                HorizontalOptions = LayoutOptions.End,
                FontSize = 24,
            };
            lblPrice.SetBinding(Label.TextProperty, new Binding("Price", stringFormat: "\t\t\t{0:C2}"));

            var countLayout = new StackLayout()
            {
                HorizontalOptions = LayoutOptions.StartAndExpand,
                Orientation = StackOrientation.Horizontal,
                Children = { lblCount, lblPrice }
            };

            return countLayout;
        }
开发者ID:RoyStobbelaar,项目名称:LubeckBeerCounter,代码行数:25,代码来源:LubeckBeerCard.cs


示例13: 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


示例14: RequiredFieldTriggerPage

		public RequiredFieldTriggerPage ()
		{
			var l = new Label {
				Text = "Entry requires length>0 before button is enabled",
			};
			l.FontSize = Device.GetNamedSize (NamedSize.Small, l); 

			var e = new Entry { Placeholder = "enter name" };

			var b = new Button { Text = "Save",

				HorizontalOptions = LayoutOptions.Center
			};
			b.FontSize = Device.GetNamedSize (NamedSize.Large ,b);

			var dt = new DataTrigger (typeof(Button));
			dt.Binding = new Binding ("Text.Length", BindingMode.Default, source: e);
			dt.Value = 0;
			dt.Setters.Add (new Setter { Property = Button.IsEnabledProperty, Value = false });
			b.Triggers.Add (dt);

			Content = new StackLayout { 
				Padding = new Thickness(0,20,0,0),
				Children = {
					l,
					e,
					b
				}
			};
		}
开发者ID:ChandrakanthBCK,项目名称:xamarin-forms-samples,代码行数:30,代码来源:RequiredFieldTriggerPage.cs


示例15: TodoItemCell

		public TodoItemCell ()
		{
			StyleId = "Cell";

			var label = new Label {
				StyleId = "CellLabel",
				YAlign = TextAlignment.Center,
				HorizontalOptions = LayoutOptions.StartAndExpand
			};
			label.SetBinding (Label.TextProperty, "Name");

			var tick = new Image {
				StyleId = "CellTick",
				Source = FileImageSource.FromFile ("check"),
				HorizontalOptions = LayoutOptions.End
			};
			tick.SetBinding (Image.IsVisibleProperty, "Done");

			var layout = new StackLayout {
				Padding = new Thickness(20, 0, 20, 0),
				Orientation = StackOrientation.Horizontal,
				HorizontalOptions = LayoutOptions.FillAndExpand,
				Children = {label, tick}
			};
			View = layout;
		}
开发者ID:crcossey,项目名称:xamarin-forms-samples,代码行数:26,代码来源:TodoItemCell.cs


示例16: ScrollTranslatePage

        public ScrollTranslatePage()
        {
            Title = "Scroll";
            Icon = "128/resizedimageullist.png";

            Content = new StackLayout
            {
                Children =
                {
                    ScrollerStackLayout,
                    AmpmStackLayout,
                    TotalTimeStackLayout
                },
                Orientation = StackOrientation.Vertical,
                Spacing = 10,
                VerticalOptions = LayoutOptions.CenterAndExpand,
                HorizontalOptions = LayoutOptions.CenterAndExpand,
                BackgroundColor = Colors.SoftGray
            };

            BackgroundColor = Colors.SoftGray;

            MinutesScroll.Unfocused += (sender, args) => { CalculateTime(); };

            HourScroll.Unfocused += (sender, args) => { CalculateTime(); };

            PastPresentScroll.Unfocused += (sender, args) => { CalculateTime(); };

            AmPmPicker.Unfocused += (sender, args) => { CalculateTime(); };
        }
开发者ID:xemil,项目名称:TidshanteringDyskalkyli,代码行数:30,代码来源:ScrollTranslatePage.cs


示例17: ListOfBeerCell2

		public ListOfBeerCell2 ()
		{
			var preBlank = new Label {
				Text = "",
				FontSize = 11
			};

			var image = new Image
			{
				Aspect = Aspect.AspectFill,
				//WidthRequest = 150,

				HorizontalOptions = LayoutOptions.Start,
				VerticalOptions = LayoutOptions.Center
			};
			image.SetBinding(Image.SourceProperty, new Binding("ProName"));

			var rslayout = CreateRightSideLayout ();

			var ctrlayout = CreateMiddleLayout ();

			var ctrrghtlayout = CreateMiddleRightLayout ();

			var leftImageLayout = new StackLayout()
			{
				Spacing = 2,
				Padding = new Thickness (5, 5, 0, 5),
				VerticalOptions = LayoutOptions.Center,
				Orientation = StackOrientation.Horizontal,
				Children = {image, ctrlayout, ctrrghtlayout, rslayout}
			};
			View = leftImageLayout;
		}
开发者ID:fabianwilliams,项目名称:JailBreakMobilePublic,代码行数:33,代码来源:ListOfBeerCell2.cs


示例18: WithoutDataTemplatePageCS

		public WithoutDataTemplatePageCS ()
		{
			Title = "Without a Data Template";
			Icon = "csharp.png";

			var people = new List<Person> {
				new Person ("Steve", 21, "USA"),
				new Person ("John", 37, "USA"),
				new Person ("Tom", 42, "UK"),
				new Person ("Lucas", 29, "Germany"),
				new Person ("Tariq", 39, "UK"),
				new Person ("Jane", 30, "USA")
			};

			var listView = new ListView { ItemsSource = people };

			Content = new StackLayout { 
				Padding = new Thickness (0, 20, 0, 0),
				Children = {
					new Label {
						Text = "ListView without a Data Template",
						FontAttributes = FontAttributes.Bold,
						HorizontalOptions = LayoutOptions.Center
					},
					listView
				}
			};
		}
开发者ID:ChandrakanthBCK,项目名称:xamarin-forms-samples,代码行数:28,代码来源:WithoutDataTemplatePageCS.cs


示例19: InitializeComponents

        private void InitializeComponents()
        {
            StackLayout layout = new StackLayout ();

            nameLabel = new Label () {
                Text = client.Name,
                FontSize = 18,
                XAlign = TextAlignment.Center
            };

            layout.Children.Add ( nameLabel );

            profileImage = new Image () {
                Source = client.PictureUrl,
                Aspect = Aspect.AspectFit
            };

            layout.Children.Add ( profileImage );

            phoneLabel = new Label () {
                Text = client.Phone,
                FontSize = 14,
                XAlign = TextAlignment.Center
            };

            layout.Children.Add ( phoneLabel );

            Content = layout;
        }
开发者ID:nchicas,项目名称:Combinado,代码行数:29,代码来源:ClientDetailPage.UI.cs


示例20: LoginPage

        public LoginPage()
        {
            user = new Entry {
                Placeholder = "Usuario"
            };
            pass = new Entry {
                IsPassword = true,
                Placeholder = "****"
            };

            Content = new StackLayout {
                Children = {
                    new Label {
                        Text = "Usuario"
                    },
                    user,
                    new Label {
                        Text = "Contraseña"
                    },
                    pass,
                    new Button {
                        Text = "Ingresar",
                        Command = new Command (Acceder)
                    }
                }
            };
        }
开发者ID:santiagohdzb,项目名称:FormsDemo,代码行数:27,代码来源:LoginPage.cs



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
C# Forms.TapGestureRecognizer类代码示例发布时间:2022-05-26
下一篇:
C# Forms.SelectedItemChangedEventArgs类代码示例发布时间: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