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


C# Label.SetBinding方法代码示例

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


在下文中一共展示了Label.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: 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

示例3: TitleBarView

        public TitleBarView()
        {
            //Spacing = 0;
            //Padding=new Thickness(10,0);
            Padding = new Thickness(10, 10);
            BackgroundColor = Color.White; //Color.FromHex("#f7f7f7");
            Orientation = StackOrientation.Vertical;
            textLabel = new Label();
            textLabel.BindingContext = this;
            lineView = new LineView()
            {
                HorizontalOptions = LayoutOptions.FillAndExpand
            };
            lineView.BindingContext = this;

            textLabel.SetBinding(Label.TextProperty,"Text");
            textLabel.SetBinding(Label.TextColorProperty, "TextColor");
            textLabel.SetBinding(Label.FontAttributesProperty, "FontAttributes");

            textLabel.SetBinding(Label.FontFamilyProperty, "FontFamily");

            textLabel.SetBinding(Label.FontSizeProperty, "FontSize");

            //lineView.SetBinding(LineView.BackgroundColorProperty, "UnderLineColor");
            lineView.BackgroundColor = Color.FromHex("#eee");
            lineView.SetBinding(LineView.HeightRequestProperty, "UnderLineHeight");

            Children.Add(textLabel);
            Children.Add(lineView);
        }
开发者ID:shawancyb,项目名称:VoiceTimeCounter,代码行数:30,代码来源:TitleBarView.cs

示例4: customCellTags

        public customCellTags()
        {
            Label l = new Label{
                FontSize = 18,
                FontAttributes = FontAttributes.Bold,
                XAlign = TextAlignment.Center,
                YAlign = TextAlignment.Center,
                WidthRequest = 200
            };

            l.SetBinding (Label.TextProperty, "Name");
            l.SetBinding (Label.TextColorProperty, "TextColour");

            Image i = new Image {
            };

            i.SetBinding (Image.SourceProperty, "checkImage");

            StackLayout cellLayout = new StackLayout {
                HorizontalOptions = LayoutOptions.CenterAndExpand,
                Spacing = 20,
                VerticalOptions = LayoutOptions.CenterAndExpand,
                Orientation = StackOrientation.Horizontal,
                Padding = 5
            };

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

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

示例5: HorizontalCell

        public HorizontalCell()
        {
            Grid grid = new Grid {
                Padding = new Thickness (5, 0, 5, 0),
                ColumnDefinitions = {
                    new ColumnDefinition { Width = new GridLength (0.3, GridUnitType.Star) },
                    new ColumnDefinition { Width = new GridLength (0.7, GridUnitType.Star) },
                },
                RowDefinitions = {
                    new RowDefinition { Height = new GridLength (1, GridUnitType.Star) }
                }
            };

            var leftLabel = new Label {
                YAlign = TextAlignment.Center,
                XAlign = TextAlignment.Start,
            };

            var rightLabel = new Label {
                YAlign = TextAlignment.Center,
                XAlign = TextAlignment.End,
            };

            leftLabel.SetBinding<HorizontalCell> (Label.TextProperty, vm => vm.Text);
            leftLabel.SetBinding<HorizontalCell> (Label.TextColorProperty, vm => vm.TextColor);

            rightLabel.SetBinding<HorizontalCell> (Label.TextProperty, vm => vm.Detail);
            rightLabel.SetBinding<HorizontalCell> (Label.TextColorProperty, vm => vm.DetailColor);

            grid.Children.Add (leftLabel, 0, 0);
            grid.Children.Add (rightLabel, 1, 0);

            grid.BindingContext = this;
            View = grid;
        }
开发者ID:AjourMedia,项目名称:ChicagoVball,代码行数:35,代码来源:HorizontalCell.cs

示例6: RangeSliderBubble

        public RangeSliderBubble()
        {
            // Init
            this.BackgroundColor = Color.Transparent;

            // Image
            _image = new Image();

            AbsoluteLayout.SetLayoutFlags(_image, AbsoluteLayoutFlags.All);
            AbsoluteLayout.SetLayoutBounds(_image, new Rectangle(0f, 0f, 1f, 1f));

            _image.SetBinding(Image.SourceProperty, new Binding(path: "Source", source: this));

            this.Children.Add(_image);

            // Label
            _label = new Label() { VerticalTextAlignment = TextAlignment.Center, HorizontalTextAlignment = TextAlignment.Center };

            AbsoluteLayout.SetLayoutFlags(_label, AbsoluteLayoutFlags.All);
            AbsoluteLayout.SetLayoutBounds(_label, new Rectangle(0.5f, 0.75f, 0.8f, 0.5f));

            _label.SetBinding(Label.TextProperty, new Binding(path: "Text", source: this));
            _label.SetBinding(Label.FontFamilyProperty, new Binding(path: "FontFamily", source: this));
            _label.SetBinding(Label.FontSizeProperty, new Binding(path: "FontSize", source: this));
            _label.SetBinding(Label.TextColorProperty, new Binding(path: "TextColor", source: this));

            this.Children.Add(_label);
        }
开发者ID:xDelivered-Patrick,项目名称:RangeSliderView,代码行数:28,代码来源:RangeSliderView.cs

示例7: ScanPage

		public ScanPage()
		{
			this.Title = "Beacon Scanner";

			var beaconDataTemplate = new DataTemplate(() =>
			{
				var identifierLabel = new Label { HorizontalTextAlignment = TextAlignment.Start };
				var proximityLabel = new Label { HorizontalTextAlignment = TextAlignment.Start };
				var distanceLabel = new Label { HorizontalTextAlignment = TextAlignment.Start };
				var mtsLabel = new Label { HorizontalTextAlignment = TextAlignment.Start };

				identifierLabel.Text = "Kontakt";
				identifierLabel.FontSize = 20;
				//identifierLabel.SetBinding(Label.TextProperty, "Distance");
				proximityLabel.FontSize = 15;
				proximityLabel.SetBinding(Label.TextProperty, "Distance");

				distanceLabel.FontSize = 12;
				distanceLabel.SetBinding(Label.TextProperty, "Proximity");
				distanceLabel.SetBinding(Label.TextColorProperty, "Proximity", BindingMode.Default, new ColorConverter());

				mtsLabel.FontSize = 12;
				mtsLabel.SetBinding(Label.TextProperty, "Meters", BindingMode.Default, new MtsConverter());

				var beaconInfo = new StackLayout();
				beaconInfo.Padding = new Thickness(10, 0, 0, 0);
				//beaconInfo.Orientation = StackOrientation.Horizontal;
				beaconInfo.Children.Add(identifierLabel);
				beaconInfo.Children.Add(proximityLabel);
				beaconInfo.Children.Add(
					new StackLayout{
					Orientation = StackOrientation.Horizontal,
					Children = { distanceLabel, mtsLabel }
				});

				return new ViewCell { View = beaconInfo };
			});

			_beaconsList = new ListView();
			_beaconsList.RowHeight = 80;
			_beaconsList.VerticalOptions = LayoutOptions.FillAndExpand;
			_beaconsList.ItemTemplate = beaconDataTemplate;


			var container = new StackLayout();
			container.HorizontalOptions = LayoutOptions.FillAndExpand;
			container.VerticalOptions = LayoutOptions.FillAndExpand;
			container.Children.Add(_beaconsList);

			this.Content = container;
		}
开发者ID:Chepeman,项目名称:BeaconScanner,代码行数:51,代码来源:ScanPage.cs

示例8: CreateMiddleRightLayout

		static StackLayout CreateMiddleRightLayout()
		{
			var ibuLabel = new Label
			{
				HorizontalOptions= LayoutOptions.StartAndExpand,
				FontSize = 11
			};
			ibuLabel.SetBinding(Label.TextProperty, "Ibu");

			var abvLabel = new Label
			{
				HorizontalOptions= LayoutOptions.StartAndExpand,
				FontSize = 11
			};
			abvLabel.SetBinding(Label.TextProperty, "Abv");

			var ctrrghtlayout = new StackLayout ()
			{
				VerticalOptions = LayoutOptions.Center,
				Orientation = StackOrientation.Vertical,
				Children = {ibuLabel, abvLabel }
			};

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

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

示例10: FancyListCell

        public FancyListCell()
        {
            var image = new Image
              {
            HorizontalOptions = LayoutOptions.Start
              };
              image.SetBinding(Image.SourceProperty, new Binding("Icon"));
              image.WidthRequest = image.HeightRequest = 50;

              var nameLabel = new Label
              {
            HorizontalOptions = LayoutOptions.FillAndExpand,
            VerticalOptions = LayoutOptions.Center,
            FontSize = 26,
            TextColor = Color.Red
               // BackgroundColor = Color.FromRgba(0,0,0,0.5f)
              };
              nameLabel.SetBinding(Label.TextProperty, "Title");

              var viewLayout = new StackLayout()
              {
            Orientation = StackOrientation.Horizontal,
            Spacing = 10,
            Padding = 15,
            Children = { image, nameLabel }
              };
              View = viewLayout;
        }
开发者ID:RobertoOFonseca,项目名称:MySafety,代码行数:28,代码来源:FancyListCell.cs

示例11: CustomCell

            public CustomCell()
            {
                //instantiate each of our views
                var image = new Image();
                StackLayout cellWrapper = new StackLayout();
                StackLayout horizontalLayout = new StackLayout();
                Label left = new Label();
                Label right = new Label();

                //set bindings
                left.SetBinding(Label.TextProperty, "name");
                right.SetBinding(Label.TextProperty, "description");
                image.SetBinding(Image.SourceProperty, "profileIcon");

                //Set properties for desired design
                cellWrapper.BackgroundColor = Color.FromHex("#eee");
                horizontalLayout.Orientation = StackOrientation.Horizontal;
                right.HorizontalOptions = LayoutOptions.EndAndExpand;
                left.TextColor = Color.FromHex("#f35e20");
                right.TextColor = Color.FromHex("503026");

                //add views to the view hierarchy
                horizontalLayout.Children.Add(image);
                horizontalLayout.Children.Add(left);
                horizontalLayout.Children.Add(right);
                cellWrapper.Children.Add(horizontalLayout);
                View = cellWrapper;
            }
开发者ID:sabeersulaiman,项目名称:OAuthTwoDemo.XForms,代码行数:28,代码来源:ProfilePage.cs

示例12: CreateCellView

        private Xamarin.Forms.View CreateCellView(string content, int colIndex, int rowIndex)
        {
            // Create the container view
            var container = new StackLayout()
            {
                BackgroundColor = rowIndex == 0 ? Color.Black : Color.White,
                Padding = new Thickness(10)
            };

            // Create the label
            var label = new Label()
            {
                Text = rowIndex == 0 ? content : content.Replace(",", "\r\n"),
                BackgroundColor = rowIndex == 0 ? Color.Black : Color.White,
                VerticalOptions = LayoutOptions.FillAndExpand,
                HorizontalOptions = LayoutOptions.FillAndExpand,
                VerticalTextAlignment = TextAlignment.Center,
                HorizontalTextAlignment = TextAlignment.Start,
                TextColor = rowIndex == 0 ? Color.White : Color.Black,
                FontSize = 12,
                LineBreakMode = LineBreakMode.WordWrap
            };

            if (rowIndex == 0)
            {
                label.FontAttributes = FontAttributes.Bold;
            }

            label.SetBinding(Label.FontFamilyProperty, new Binding(path: "FontFamily", source: this));

            container.Children.Add(label);

            // Return...
            return container;
        }
开发者ID:Manne990,项目名称:XamTest,代码行数:35,代码来源:TableView.cs

示例13: InitialPage

        public InitialPage()
        {
            BindingContext = new InitialPageModel (this.Navigation);

            Title = "Welcome to Peter";

            Label timeLabel = new Label {
                HorizontalOptions = LayoutOptions.Center,
            };
            timeLabel.SetBinding<InitialPageModel> (Label.TextProperty, vm => vm.DrinkingHoursDisplay);

            Slider timeSlider = new Slider (1, 24, 5) {
                HorizontalOptions = LayoutOptions.FillAndExpand,
            };
            timeSlider.SetBinding<InitialPageModel> (Slider.ValueProperty, vm => vm.DrinkingHours, BindingMode.TwoWay);

            Button pressMe = new Button {
                Text = "Help Peter",
                HorizontalOptions = LayoutOptions.CenterAndExpand,
                VerticalOptions = LayoutOptions.CenterAndExpand,
                FontSize = 60,
                HeightRequest = 200,
                BackgroundColor = Color.Yellow,
            };
            pressMe.SetBinding<InitialPageModel> (Button.CommandProperty, vm => vm.PressMeCommand);

            Content = new StackLayout {
                Children = {
                    timeLabel,
                    timeSlider,
                    pressMe,
                }
            };
        }
开发者ID:RickNabb,项目名称:Peter,代码行数:34,代码来源:InitialPage.cs

示例14: ProductEditCell

        public ProductEditCell()
        {
            //instantiate each of our views
            StackLayout cellWrapper = new StackLayout ();
            StackLayout horizontalLayout = new StackLayout ();
            Label left = new Label ();
            Label arrow = new Label ();

            //set bindings
            left.SetBinding (Label.TextProperty, "title");

            //Set properties for desired design
            cellWrapper.BackgroundColor = Color.FromHex ("#eee");
            horizontalLayout.Orientation = StackOrientation.Horizontal;
            left.TextColor = Color.FromHex ("#f35e20");
            arrow.TextColor = Color.FromHex ("#f35e20");
            arrow.Text = ">";
            arrow.HorizontalOptions =LayoutOptions.EndAndExpand;
            //add views to the view hierarchy
            horizontalLayout.Children.Add (left);
            horizontalLayout.Children.Add (arrow);

            cellWrapper.Children.Add (horizontalLayout);
            View = cellWrapper;
        }
开发者ID:sliderif,项目名称:Coffetab,代码行数:25,代码来源:ProductEditCell.cs

示例15: GetCountryRenderChartTooltip

        public static StackLayout GetCountryRenderChartTooltip(FlexChart flexChart)
        {
            Image image = new Image();
            Label title = new Label();
            Label content = new Label();

            StackLayout container = new StackLayout();
            container.Padding = 5;


            container.BackgroundColor = Color.FromHex("#FFFFCA");

            title.SetBinding(Label.TextProperty, "SeriesName");
            title.TextColor = Color.Black;
            title.FontAttributes = FontAttributes.Bold;
            title.FontSize = 14;
            image.SetBinding(Image.SourceProperty, "XValue", BindingMode.OneWay, new FlagConverter());

            StackLayout horizontalContainer = new StackLayout();
            horizontalContainer.Orientation = StackOrientation.Horizontal;

            content.SetBinding(Label.TextProperty, "YValue");
            content.TextColor = Color.Black;
            content.FontSize = 14;

            horizontalContainer.Children.Add(image);
            horizontalContainer.Children.Add(title);

            container.Children.Add(horizontalContainer);
            container.Children.Add(content);

            return container;

            //((RelativeLayout)flexChart.Parent).Children.Add(this, Constraint.Constant(50), Constraint.Constant(50));
        }
开发者ID:techShubham,项目名称:Xamarin.Forms-Samples,代码行数:35,代码来源:CountryRenderChartTooltip.cs


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