當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。