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


C# StackLayout.SetBinding方法代码示例

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


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

示例1: sideCustomViewCell

        public sideCustomViewCell()
        {
            StackLayout s = new StackLayout {
                HorizontalOptions = LayoutOptions.Center,
                VerticalOptions = LayoutOptions.Center,
                Orientation = StackOrientation.Horizontal,
                Padding = 10,
                Spacing = 10
            };
            s.SetBinding (StackLayout.BackgroundColorProperty, "Background");

            Label l = new Label {
                FontSize = 17,
                FontAttributes = FontAttributes.Bold,
                XAlign = TextAlignment.Center,
                YAlign = TextAlignment.Center
            };
            l.SetBinding (Label.TextProperty, "Title");
            l.SetBinding (Label.TextColorProperty, "TextColour");

            Image i = new Image {
            };
            i.SetBinding (Image.SourceProperty, "IconSource");

            s.Children.Add (i);
            s.Children.Add (l);

            this.View = s;
        }
开发者ID:jarade,项目名称:IAB330Project,代码行数:29,代码来源:sideCustomViewCell.cs

示例2: MenuImageCell

        public MenuImageCell()
            : base()
        {
            Label Text = new Label {
                TextColor = Color.FromHex ("DCDCDC"),
                XAlign = TextAlignment.Start,
                YAlign = TextAlignment.Center
            };
            Text.SetBinding (Label.TextProperty, "Title");

            Label pad = new Label {
                Text = " "
            };

            Image image = new Image {
                // Backup: Default icon to set
                //Source = "info.png",
                HeightRequest = 30,
            };

            image.SetBinding (Image.SourceProperty, "Icon");

            var layout = new StackLayout {
                Orientation = StackOrientation.Horizontal,
                HorizontalOptions = LayoutOptions.Start,
                VerticalOptions = LayoutOptions.Center,
                Children = { pad, image, pad, Text }
            };
            layout.SetBinding (Layout.BackgroundColorProperty, new Binding ("BackgroundColor"));

            if (Device.OS == TargetPlatform.WinPhone)
                layout.HeightRequest = 50;

            View = layout;
        }
开发者ID:auxua,项目名称:Qurvey,代码行数:35,代码来源:MenuImageCell.cs

示例3: OpcionesCell

    public OpcionesCell()
    {
      var image = new Image
      {
        HorizontalOptions = LayoutOptions.Start,
      };
      image.SetBinding(Image.SourceProperty, new Binding("Imagen"));
      image.SetBinding(Image.BackgroundColorProperty, new Binding("ColorFondo", BindingMode.OneWay, new ColorConverter()));
      image.WidthRequest = image.HeightRequest = 24;

      var nameLabel = new Label
      {
        HorizontalOptions = LayoutOptions.FillAndExpand,
        TextColor = Color.Black,
        BackgroundColor = Color.Gray
      };
      nameLabel.SetBinding(Label.TextProperty, "Nombre");
      nameLabel.SetBinding(Label.BackgroundColorProperty, new Binding("ColorFondo", BindingMode.OneWay, new ColorConverter()));

      var viewLayout = new StackLayout()
      {
        Orientation = StackOrientation.Horizontal,
        VerticalOptions = LayoutOptions.CenterAndExpand,
        Children = { image, nameLabel}
      };
      viewLayout.SetBinding(StackLayout.BackgroundColorProperty, new Binding("ColorFondo", BindingMode.OneWay, new ColorConverter()));

      View = viewLayout;
    }
开发者ID:palaniakasapu,项目名称:Xamarin,代码行数:29,代码来源:OpcionesCell.cs

示例4: JobHeaderView

        public JobHeaderView()
        {
            var number = new Label();
            number.TextColor = Color.White;
            number.WidthRequest = 30;
            number.Font = AppStyle.DefaultFont.WithSize(NamedSize.Large).WithAttributes(FontAttributes.Bold);
            number.SetBinding<Job>(Label.TextProperty, job => job.JobNumber);

            var eta = new Label();
            eta.VerticalOptions = LayoutOptions.FillAndExpand;
            eta.HorizontalOptions = LayoutOptions.FillAndExpand;
            eta.YAlign = TextAlignment.Center;
            eta.TextColor = Color.White;
            eta.Font = AppStyle.DefaultFont;
            eta.SetBinding<Job>(Label.TextProperty, job => job.EtaTime);

            var rootLayout = new StackLayout
            {
                Orientation = StackOrientation.Horizontal,
                Padding = 5,
                Children = { number, eta }
            };
            rootLayout.SetBinding<Job>(StackLayout.BackgroundColorProperty, job => job.Status, converter: new JobStatusToColorConverter());

            this.Content = rootLayout;
        }
开发者ID:soninaren,项目名称:FieldEngineerLite,代码行数:26,代码来源:JobHeaderView.cs

示例5: JobHeaderView

        public JobHeaderView()
        {
            var number = new Label();
            number.TextColor = Color.White;
            number.WidthRequest = 60;
            number.FontSize = Device.GetNamedSize (NamedSize.Medium, typeof(Label));
            number.FontAttributes = FontAttributes.Bold;
            number.SetBinding<Job>(Label.TextProperty, job => job.JobNumber);

            var eta = new Label();
            eta.VerticalOptions = LayoutOptions.FillAndExpand;
            eta.HorizontalOptions = LayoutOptions.FillAndExpand;
            eta.YAlign = TextAlignment.Center;
            eta.TextColor = Color.White;
            //eta.Font = AppStyle.DefaultFont;
            eta.SetBinding<Job>(Label.TextProperty, job => job.StartTime);

            var name = new Label();
            name.VerticalOptions = LayoutOptions.FillAndExpand;
            name.HorizontalOptions = LayoutOptions.FillAndExpand;
            name.YAlign = TextAlignment.Center;
            name.TextColor = Color.White;
            //name.Font = AppStyle.DefaultFont;
            name.SetBinding<Job>(Label.TextProperty, job => job.CustomerName);

            var rootLayout = new StackLayout
            {
                Orientation = StackOrientation.Horizontal,
                Padding = 5,
                Children = { number, eta, name }
            };
            rootLayout.SetBinding<Job>(StackLayout.BackgroundColorProperty, job => job.Status, converter: new JobStatusToColorConverter());

            this.Content = rootLayout;
        }
开发者ID:pellehenriksson,项目名称:fieldengineer,代码行数:35,代码来源:JobHeaderView.cs

示例6: MenuViewCell

        public MenuViewCell()
        {
            var img = new Image
            {
                VerticalOptions = LayoutOptions.Start
            };
            img.SetBinding(Image.SourceProperty, "Icone");

            var lblMenu = new Label
            {
                Style = Estilos._estiloFonteMenu
            };
            lblMenu.SetBinding(Label.TextProperty, "Titulo");

            var mainLayout = new StackLayout
            {
                Orientation = StackOrientation.Horizontal,
                VerticalOptions = LayoutOptions.FillAndExpand,
                Children = { img, lblMenu },
                Padding = 10
            };

            mainLayout.SetBinding(StackLayout.BackgroundColorProperty, "Color");

            this.View = mainLayout;
        }
开发者ID:jbravobr,项目名称:Mais-XamForms,代码行数:26,代码来源:MenuViewCell.cs

示例7: ActiveChatsPage

        public ActiveChatsPage(ViewModelBase viewModel)
            : base(viewModel)
        {
            var listView = new BindableListView
            {
                ItemTemplate = new DataTemplate(() =>
                    {
                        var imageCell = new ImageCell();
                        imageCell.SetBinding(ImageCell.TextProperty, new Binding("Name"));
                        imageCell.SetBinding(ImageCell.DetailProperty, new Binding("DescriptionText"));
                        imageCell.SetBinding(ImageCell.ImageSourceProperty, new Binding("Image"));
                        imageCell.TextColor = Styling.CellTitleColor;
                        imageCell.DetailColor = Styling.CellDetailColor;
                        return imageCell;
                    }),
                SeparatorVisibility = SeparatorVisibility.None
            };

            listView.SetBinding(ListView.ItemsSourceProperty, new Binding("ActiveChats"));
            listView.SetBinding(BindableListView.ItemClickedCommandProperty, new Binding("SelectActiveChatCommand"));
            listView.SetBinding(ListView.IsVisibleProperty, new Binding("HasConversations", BindingMode.OneWay));

            var noItemsLabel = new Label {
                Text = "Start a conversation or open a room!",
                HorizontalOptions = LayoutOptions.Center,
                FontSize = 16,
                TextColor = Color.Gray
            };
            var noItemsLayout = new StackLayout
            {
                VerticalOptions = LayoutOptions.FillAndExpand,
                HorizontalOptions = LayoutOptions.FillAndExpand,
                Children =
                {
                    new BoxView{HeightRequest = 20},
                    noItemsLabel
                }
            };
            noItemsLayout.SetBinding(StackLayout.IsVisibleProperty, new Binding("HasConversations", BindingMode.OneWay, converter: new InverterConverter()));

            var loadingIndicator = new ActivityIndicator ();
            loadingIndicator.SetBinding(ActivityIndicator.IsRunningProperty, new Binding("IsBusy"));
            loadingIndicator.SetBinding(ActivityIndicator.IsVisibleProperty, new Binding("IsBusy"));

            Content = new StackLayout
            {
                Children =
                {
                    loadingIndicator,
                    listView,
                    noItemsLayout
                }
            };
        }
开发者ID:alexnaraghi,项目名称:SharedSquawk,代码行数:54,代码来源:ActiveChatsPage.cs

示例8: CreateNoSessionStack

		static StackLayout CreateNoSessionStack ()
        {
			var noSessionStack = new StackLayout 
			{
				Orientation = StackOrientation.Horizontal,
				HorizontalOptions = LayoutOptions.StartAndExpand,
				VerticalOptions = LayoutOptions.EndAndExpand,
				Spacing = 10
			};
			noSessionStack.SetBinding (Frame.IsVisibleProperty, "IsBooked", converter: new NegateValueConverter ());
			noSessionStack.Children.Add (CreateAddIcon ());
			noSessionStack.Children.Add (CreateNoSessionLabel ());
			return noSessionStack;
        }
开发者ID:vgvassilev,项目名称:couchbase-connect-14,代码行数:14,代码来源:AgendaCell.cs

示例9: MainPage

		public MainPage ()
		{
			Title = "TripLog";

			var itemTemplate = new DataTemplate (typeof(TextCell));
			itemTemplate.SetBinding (TextCell.TextProperty, "Title");
			itemTemplate.SetBinding (TextCell.DetailProperty, "Notes");

			var entries = new ListView {
				ItemTemplate = itemTemplate
			};
			entries.SetBinding (ListView.ItemsSourceProperty, "LogEntries");
			entries.SetBinding (ListView.IsVisibleProperty, "IsBusy", converter: new ReverseBooleanConverter());

			entries.ItemTapped += (sender, e) => 
			{
				var item = (TripLogEntry) e.Item;
				vm.ViewCommand.Execute (item);
			};

			var newButton = new ToolbarItem { Text = "New" };
			newButton.SetBinding (ToolbarItem.CommandProperty, "NewCommand");
			ToolbarItems.Add (newButton);

			var loading = new StackLayout {
				Orientation = StackOrientation.Vertical,
				HorizontalOptions = LayoutOptions.Center,
				VerticalOptions = LayoutOptions.Center,
				Children = {
					new ActivityIndicator {
						IsRunning = true
					},
					new Label {
						Text = "Loading Entries..."
					}
				}
			};

			loading.SetBinding (StackLayout.IsVisibleProperty, "IsBusy");

			var mainLayout = new Grid {
				Children = {
					entries, 
					loading
				}
			};

			Content = mainLayout;
		}
开发者ID:blombas,项目名称:TripLog,代码行数:49,代码来源:MainPage.cs

示例10: CreateRootStack

        View CreateRootStack ()
        {
            var stack = new StackLayout {
                Orientation = StackOrientation.Horizontal,
                Padding = 12,
                Children =  {
                    new SessionItem (),
                    CreateSelectionIndicator ()
                }
            };
            stack.SetBinding (StackLayout.BackgroundColorProperty, "Track",
                converter: new TrackBackgroundColorConverter ());

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

示例11: JobCell

        public JobCell()
        {
            var jobHeader = new JobHeaderView();

            var title = new Label();
            //title.Font = AppStyle.DefaultFont;
            title.SetBinding<Job>(Label.TextProperty, job => job.Title);

            var customer = new Label();
            //customer.Font = AppStyle.DefaultFont;
            customer.SetBinding<Job>(Label.TextProperty, job => job.CustomerName);

            var jobDetails = new StackLayout
            {
                Orientation = StackOrientation.Vertical,
                Padding = 5,
                Children =
                {
                    new StackLayout
                    {
                        Orientation = StackOrientation.Horizontal,
                        Children = {
                            new Label { Text = "Customer:", FontAttributes = FontAttributes.Bold },
                            customer
                        }
                    },
                    new Label { Text = "Description:", FontAttributes = FontAttributes.Bold },
                    title
                }
            };
            jobDetails.SetBinding<Job>(StackLayout.BackgroundColorProperty, job => job.Status, converter: new JobStatusToColorConverter(useLightTheme: true));

            var rootLayout = new StackLayout()
            {
                Orientation = StackOrientation.Vertical,
                Spacing = 0,
                Children =
                {
                    jobHeader,
                    jobDetails
                }
            };

            this.Height = 130;
            this.View = rootLayout;
        }
开发者ID:pellehenriksson,项目名称:fieldengineer,代码行数:46,代码来源:JobCell.cs

示例12: CreateTopRow

        static View CreateTopRow ()
        {

			var profile = new StackLayout {
				Orientation = StackOrientation.Horizontal,
				Spacing = 18,
				HeightRequest = 50,
				Padding = new Thickness (20, 40, 10, 10),
				//BackgroundColor = Color.Green,
				Children = {
					CreateQRBox (),
					CreateNameStack ()
				}
			};
			profile.SetBinding(StackLayout.IsVisibleProperty, "HasProfile");
			var profileTapGesture = new TapGestureRecognizer();
			profileTapGesture.SetBinding (TapGestureRecognizer.CommandProperty, "AddContactCommand");
			profile.GestureRecognizers.Add (profileTapGesture);

			var noProfile = new StackLayout {
				Orientation = StackOrientation.Horizontal,
				HorizontalOptions = LayoutOptions.CenterAndExpand,
				Spacing = 18,
				HeightRequest = 50,
				Padding = new Thickness (20, 40, 10, 10),
				//BackgroundColor = Color.Red,
				Children = {
					CreateNoProfileView ()
				}
			};
			noProfile.SetBinding(StackLayout.IsVisibleProperty, "HasProfile", converter: new NegateValueConverter());
			var noProfileTapGesture = new TapGestureRecognizer();
			noProfileTapGesture.SetBinding<MenuViewModel> (TapGestureRecognizer.CommandProperty, vm => vm.CreateProfileCommand);
			noProfile.GestureRecognizers.Add (noProfileTapGesture);

			var grid = new Grid {
				Children = {
					profile,
					noProfile
				}
			};

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

示例13: JobHeaderView

        public JobHeaderView(double leftPadding, bool colorBackground = false)
        {
            var eta = new Label();
            eta.VerticalOptions = LayoutOptions.FillAndExpand;
            eta.HorizontalOptions = LayoutOptions.FillAndExpand;
            eta.VerticalTextAlignment = TextAlignment.Start;
            eta.SetBinding<Job>(Label.TextProperty, job => job.StartTime, stringFormat: "Start time: {0}");

            var rootLayout = new StackLayout {
                Orientation = StackOrientation.Horizontal,
                Padding = new Thickness(leftPadding, 5, 0, 5),
                Children = { eta }
            };

            if (colorBackground) {
                eta.TextColor = Color.White;
                rootLayout.SetBinding<Job>(StackLayout.BackgroundColorProperty, job => job.Status, converter: new JobStatusToColorConverter());
            }

            this.Content = rootLayout;
        }
开发者ID:bdanen,项目名称:app-service-mobile-donet-fieldengineer,代码行数:21,代码来源:JobHeaderView.cs

示例14: JobGroupingHeaderCell

        public JobGroupingHeaderCell()
        {
            var title = new Label
            {
                Font = AppStyle.DefaultFont.WithSize(NamedSize.Medium).WithAttributes(FontAttributes.Bold),
                TextColor = Color.White,
                VerticalOptions = LayoutOptions.Center
            };

            title.SetBinding(Label.TextProperty, new Binding("Key", stringFormat: "Job Status: {0}"));

            var layout = new StackLayout
            {
                Padding = 5,
                Orientation = StackOrientation.Horizontal,
                Children = { title }
            };
            layout.SetBinding(StackLayout.BackgroundColorProperty, "Key", converter: new JobStatusToColorConverter());

            this.Height = 35;
            this.View = layout;
        }
开发者ID:soninaren,项目名称:FieldEngineerLite,代码行数:22,代码来源:JobGroupingHeaderCell.cs

示例15: MenuCell

        public MenuCell()
        {
            //instantiate each of our views
            StackLayout stckMenuWrapper = new StackLayout ();
            StackLayout stckHorizontalMenuWrapper = new StackLayout ();
            StackLayout stckVerticalWrapper = new StackLayout ();
            Image imagem = new Image ();
            BoxView separador = new BoxView ();
            Label title = new Label ();
            Label descrption = new Label ();

            //set bindings
            imagem.SetBinding (Image.SourceProperty, "Image");
            title.SetBinding (Label.TextProperty, "DisplayName");
            descrption.SetBinding (Label.TextProperty, "Description");
            stckHorizontalMenuWrapper.SetBinding (StackLayout.BackgroundColorProperty, "BackgroundColor");

            //set properties
            stckMenuWrapper.Orientation = StackOrientation.Vertical;
            stckHorizontalMenuWrapper.Orientation = StackOrientation.Horizontal;
            stckVerticalWrapper.Orientation = StackOrientation.Vertical;
            stckHorizontalMenuWrapper.Padding = new Thickness (10);
            separador.BackgroundColor = Color.Transparent;
            separador.IsEnabled = false;
            title.TextColor = Color.White;
            descrption.TextColor = Color.White;
            title.FontSize = 21;
            descrption.FontSize = 12;

            //add views to the view hierarchy
            stckVerticalWrapper.Children.Add(title);
            stckVerticalWrapper.Children.Add(descrption);
            stckHorizontalMenuWrapper.Children.Add(imagem);
            stckHorizontalMenuWrapper.Children.Add(stckVerticalWrapper);
            stckMenuWrapper.Children.Add (stckHorizontalMenuWrapper);
            stckMenuWrapper.Children.Add (separador);

            View = stckMenuWrapper;
        }
开发者ID:vileladiego,项目名称:TravelApp,代码行数:39,代码来源:MenuCell.cs


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