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


C# Label.SetBinding方法代码示例

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


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

示例1: ClubMemberViewCell

        public ClubMemberViewCell()
        {

            nameTGR = new TapGestureRecognizer();
            nameTGR.Tapped += NameTGR_Tapped;

            ch = new ColorHandler();
            iEmoji = new Image
            {
                Aspect = Aspect.AspectFit,
                WidthRequest = 75,
                HorizontalOptions = LayoutOptions.StartAndExpand,
                VerticalOptions = LayoutOptions.Center
            };
            iEmoji.SetBinding(Image.SourceProperty, "Emoji");
            lUsername = new Label
            {
                HorizontalOptions = LayoutOptions.CenterAndExpand,
                FontSize = Device.GetNamedSize(NamedSize.Large, typeof(Label)),
                VerticalOptions = LayoutOptions.Center
            };
            lUsername.SetBinding(Label.TextProperty, "Username");
            lUsername.SetBinding(Label.TextColorProperty, "UserColor", converter: new ColorConverter());
            lUsername.GestureRecognizers.Add(nameTGR);
            updateView();
        }
开发者ID:bpeck81,项目名称:Cloudclub_v1,代码行数:26,代码来源:ClubMemberViewCell.cs

示例2: IdeaItemCell

        public IdeaItemCell()
        {
            var ideaLabel = new Label
            {
                TextColor = StyleKit.PrimaryTextColor,
                FontSize = Device.GetNamedSize(NamedSize.Medium, typeof(Label))
            };
            ideaLabel.SetBinding(Label.TextProperty, new Binding("Name"));

            var ratingLabel = new Label
            {
                TextColor = StyleKit.SecondaryTextColor,
                FontSize = Device.GetNamedSize(NamedSize.Small, typeof(Label))
            };
            ideaLabel.SetBinding(Label.TextProperty, new Binding("Rating", BindingMode.OneWay, null, null, "Rating: {0}"));

            var layout = new StackLayout
            {
                Padding = new Thickness(20, 0, 0, 0),
                Orientation = StackOrientation.Vertical,
                HorizontalOptions = LayoutOptions.StartAndExpand,
                Children = { ideaLabel, ratingLabel }
            };

            View = layout;
        }
开发者ID:rprouse,项目名称:IdeaTrackr-v1,代码行数:26,代码来源:IdeaItemCell.cs

示例3: updateView

        private void updateView()
        {
            iEmoji = new Image
            {
                Aspect = Aspect.AspectFit,
                WidthRequest = 75,
                HorizontalOptions = LayoutOptions.StartAndExpand,
                VerticalOptions = LayoutOptions.Center
            };
            iEmoji.SetBinding(Image.SourceProperty, "Emoji");

            lUsername = new Label
            {
                HorizontalOptions = LayoutOptions.CenterAndExpand,
                FontSize = Device.GetNamedSize(NamedSize.Large, typeof(Label)),
                VerticalOptions = LayoutOptions.Center
            };
            lUsername.SetBinding(Label.TextProperty, "Username");
            lUsername.SetBinding(Label.TextColorProperty, "UserColor", converter: new ColorConverter());

            bAddFriend = new Button
            {
                Text = "+",
                FontAttributes = FontAttributes.Bold,
                TextColor = ch.fromStringToColor("gray"),
                BackgroundColor = ch.fromStringToColor("white"),
                HorizontalOptions = LayoutOptions.EndAndExpand,
                VerticalOptions = LayoutOptions.Center
            };
            bAddFriend.Clicked += BAddFriend_Clicked;

            bFriendsIndicator = new Button
            {
                BackgroundColor = ch.fromStringToColor("yellow"),
                BorderRadius = 100,
                HeightRequest = 20,
                WidthRequest = 20,
                HorizontalOptions = LayoutOptions.EndAndExpand,
                VerticalOptions = LayoutOptions.Center,
                IsVisible = false
            };

            View = new StackLayout
            {
                Children ={
                    iEmoji,
                    lUsername,
                    bAddFriend,
                    bFriendsIndicator
                },
                Orientation = StackOrientation.Horizontal,
                HorizontalOptions = LayoutOptions.FillAndExpand,
                Padding = new Thickness(10, 0, 10, 0),
                BackgroundColor = ch.fromStringToColor("white")
            };
        }
开发者ID:bpeck81,项目名称:Cloudclub_v1,代码行数:56,代码来源:inviteFriendsViewCell.cs

示例4: Init

		protected override void Init ()
		{
			var listView = new ListView ();

			var selection = new Selection ();
			listView.SetBinding (ListView.ItemsSourceProperty, "Items");

			listView.ItemTemplate = new DataTemplate (() => {
				var cell = new SwitchCell ();
				cell.SetBinding (SwitchCell.TextProperty, "Name");
				cell.SetBinding (SwitchCell.OnProperty, "IsSelected", BindingMode.TwoWay);
				return cell;
			});

			var instructions = new Label {
				FontSize = 16,
				Text =
					"The label at the bottom should equal the number of switches which are in the 'on' position. Flip some of the switches. If the number at the bottom does not equal the number of 'on' switches, the test has failed."
			};

			var label = new Label { FontSize = 24 };
			label.SetBinding (Label.TextProperty, "SelectedCount");

			Content = new StackLayout {
				VerticalOptions = LayoutOptions.Fill,
				Children = {
					instructions,
					listView,
					label
				}
			};

			BindingContext = selection;
		}
开发者ID:Costo,项目名称:Xamarin.Forms,代码行数:34,代码来源:Bugzilla31964.cs

示例5: Init

		protected override void Init ()
		{
			var entry = new Entry {
				Text = "Setec Astronomy",
				FontFamily = "Comic Sans MS",
				HorizontalTextAlignment = TextAlignment.Center,
				Keyboard = Keyboard.Chat
			};

			var label = new Label ();
			var binding = new Binding ("Text") { Source = entry };

			var otherEntry = new Entry ();
			var otherBinding = new Binding ("Text") { Source = entry, Mode = BindingMode.TwoWay };
			otherEntry.SetBinding (Entry.TextProperty, otherBinding);

			label.SetBinding (Label.TextProperty, binding);

			var explanation = new Label() {Text = @"The Text value of the entry at the top should appear in the label and entry below, regardless of whether 'IsPassword' is on. 
Changes to the value in the entry below should be reflected in the entry at the top."};

			var button = new Button { Text = "Toggle IsPassword" };
			button.Clicked += (sender, args) => { entry.IsPassword = !entry.IsPassword; };

			Content = new StackLayout {
				Children = { entry, button, explanation, label, otherEntry }
			};
		}
开发者ID:Costo,项目名称:Xamarin.Forms,代码行数:28,代码来源:IsPasswordToggleTest.cs

示例6: FacebookLoginPage

        public FacebookLoginPage(FacebookConnection connection)
        {
            this.Title = "FacebookLoginPage";

         //   Connection = new FacebookConnection(key, secret, scope);
         //   connection.SignInCompleted += Connection_SignInCompleted;
            
            this._Connection = connection;

            this._Browser = new WebView();
			//_Browser.Source = new UrlWebViewSource() { Url = _Connection.LoginUri().AbsoluteUri };
            this._Connection.SignIn(this._Browser);

			Label lbl = new Label ()
			{ Text = "Connecting..." };
			lbl.SetBinding(Label.IsVisibleProperty, "IsVisible", BindingMode.OneWay, new BooleanInverterConverter());
            lbl.BindingContext = this._Browser;

            this._BaseLayout = new StackLayout()
            {
				Orientation = StackOrientation.Vertical,
				HorizontalOptions = LayoutOptions.FillAndExpand,
				VerticalOptions = LayoutOptions.FillAndExpand,
			};

            this._BaseLayout.Children.Add(lbl);
            this._BaseLayout.Children.Add(this._Browser);

            this._Browser.IsVisible = false;
                        	

            Padding = new Thickness(0, Device.OnPlatform(20, 0, 0), 0, 0);  // Accomodate iPhone status bar.
            Content = this._BaseLayout;
        }
开发者ID:pedroccrl,项目名称:Xamarin.Plugins-1,代码行数:34,代码来源:FacebookLoginPage.cs

示例7: PersonCell

		public PersonCell ()
		{
			var grid = new Grid{ 
				RowDefinitions = new RowDefinitionCollection {
					new RowDefinition {Height = new GridLength (1, GridUnitType.Star)},
					new RowDefinition {Height = GridLength.Auto},
				},
				ColumnDefinitions = new ColumnDefinitionCollection {
					new ColumnDefinition {Width = new GridLength (1, GridUnitType.Star)},
					new ColumnDefinition {Width = GridLength.Auto},
				}
			};
			Label label;
			grid.Children.Add (label = new Label {BackgroundColor = Color.Lime});
			label.SetBinding (Label.TextProperty, "FirstName");			

			grid.Children.Add (label = new Label (),0,1);
			label.SetBinding (Label.TextProperty, "LastName");			

#pragma warning disable 618
			grid.Children.Add (label = new Label {XAlign = TextAlignment.End},1,0);
#pragma warning restore 618
			label.SetBinding (Label.TextProperty, "Zip");			

#pragma warning disable 618
			grid.Children.Add (label = new Label {XAlign = TextAlignment.End},1,1);
#pragma warning restore 618
			label.SetBinding (Label.TextProperty, "City");
			View = grid;

			
		}
开发者ID:Costo,项目名称:Xamarin.Forms,代码行数:32,代码来源:Issue1267.cs

示例8: historyCell

        public historyCell()
        {
            var NameLabel = new Label()
            {
                FontFamily = "HelveticaNeue-Medium",
                FontSize = 18,
                TextColor = Color.Black,
                HorizontalOptions = LayoutOptions.FillAndExpand
            };
            NameLabel.SetBinding(Label.TextProperty, "Name");

            var DescriptionLabel = new Label()
            {
                FontAttributes = FontAttributes.Bold,
                FontSize = 18,
                TextColor = Color.FromHex("#666"),

            };
            DescriptionLabel.SetBinding(Label.TextProperty, "omschrijving");

            var cellLayout = new StackLayout
            {
                Spacing = 0,
                Padding = new Thickness(10, 5, 10, 5),
                Orientation = StackOrientation.Vertical,
                HorizontalOptions = LayoutOptions.FillAndExpand,
                Children = { NameLabel,DescriptionLabel},
            };

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

示例9: VerbruiktArtikelCell

        public VerbruiktArtikelCell()
        {
            var nameLabel = new Label()
            {
                FontFamily = "HelveticaNeue-Medium",
                FontSize = 18,
                TextColor = Color.Black
            };
            nameLabel.SetBinding(Label.TextProperty, "Name");

            var aantalLabel = new Label()
            {
                FontAttributes = FontAttributes.Bold,
                FontSize = 18,
                TextColor = Color.Black
            };
            aantalLabel.SetBinding(Label.TextProperty, "aantal");

            var cellLayout = new StackLayout
            {
                Padding = new Thickness(10, 5, 10, 5),
                Orientation = StackOrientation.Horizontal,
                HorizontalOptions = LayoutOptions.FillAndExpand,
                Children = { nameLabel, aantalLabel },
            };

            this.View = cellLayout;
        }
开发者ID:KennyDeblaere,项目名称:Burocenter,代码行数:28,代码来源:VerbruiktArtikelCell.cs

示例10: CustomListViewCellItem

        public CustomListViewCellItem()
        {
            CustomLayout masterLayout = new CustomLayout();
            masterLayout.BackgroundColor = Color.White;//Constants.LIST_BG_COLOR;
            double screenWidth = App.screenWidth;
            double screenHeight = App.screenHeight;
            Label name = new Label();
            name.SetBinding(Label.TextProperty, "Name");
            name.TextColor = Color.Black;
            name.FontFamily = Constants.HELVERTICA_NEUE_LT_STD;
            int fontSize = 15;
            //name.FontSize = 18;
            if (App.screenDensity > 1.5)
            {
                fontSize = 17;
            }
            else
            {
                fontSize = 15;
            }
            name.FontSize = Device.OnPlatform( fontSize, fontSize, 22 );

            StackLayout divider = new StackLayout();
            divider.WidthRequest = screenWidth;
            divider.HeightRequest = 1;
            divider.BackgroundColor = Color.FromRgb(220, 220, 220);

            masterLayout.WidthRequest = screenWidth * 60 / 100;
            masterLayout.HeightRequest = screenHeight * Device.OnPlatform(30, 30, 7) / 100;

            masterLayout.AddChildToLayout(name, (float)5, (float)Device.OnPlatform(5, 5, 50), (int)masterLayout.WidthRequest, (int)masterLayout.HeightRequest);
            masterLayout.AddChildToLayout(divider, 0, (float)Device.OnPlatform(20, 20, 5), (int)masterLayout.WidthRequest, (int)masterLayout.HeightRequest);

            this.View = masterLayout;
        }
开发者ID:praveenmohanmm,项目名称:PurposeColor_Bkp_Code,代码行数:35,代码来源:CustomPicker.cs

示例11: Issue1236

		public Issue1236 ()
		{
			Content = new Label { HeightRequest = 30, WidthRequest = 200, BackgroundColor = Color.Purple.WithLuminosity (.7) };
			Content.SetBinding (Label.TextProperty, ".");

			DelayUpdatingBindingContext ();
		}
开发者ID:Costo,项目名称:Xamarin.Forms,代码行数:7,代码来源:Issue1236.cs

示例12: CSPage

        public CSPage()
        {
            BindingContext = new ViewModel.PageViewModel();

            var editor = new Editor { Text = "", HorizontalOptions = LayoutOptions.FillAndExpand };
            editor.SetBinding(Editor.TextProperty, "Message");

            switcher = new Switch {  };
            //switcher.SetBinding(Switch.IsToggledProperty, "Toggled");
            switcher.PropertyChanged += (object sender, PropertyChangedEventArgs e) =>
            {
                sclabel.SetBinding(Label.TextProperty,
                new Binding("Message",
                    converter: new Converters.StringCaseConverter(),
                    converterParameter: switcher.IsToggled));
            };

            var label = new Label
            {
                Text = "",
                HorizontalOptions = LayoutOptions.FillAndExpand,
                FontSize = 30
            };
            label.SetBinding(Label.TextProperty, "Message");

            sclabel = new Label
            {
                Text = "",
                HorizontalOptions = LayoutOptions.FillAndExpand,
                FontSize = 30
            };

            var sllabel = new Label
            {
                Text = "",
                HorizontalOptions = LayoutOptions.FillAndExpand,
                FontSize = 30
            };
            sllabel.SetBinding(Label.TextProperty,
                new Binding("Message",
                    converter: new Converters.StringToLengthConverter(),
                    stringFormat: "{0} letters"));

            Title = "Mvvm w/ C#";
            Content = new StackLayout
            {
                Padding = new Thickness(20, 5),
                Children = {
                    editor,
                    switcher,
                    label,
                    sclabel,
                    sllabel
                }
            };
        }
开发者ID:zcccust,项目名称:Study,代码行数:56,代码来源:CSPage.cs

示例13: CSViewModelConverterPage

        public CSViewModelConverterPage()
        {
            BindingContext = new ViewModel.CommonViewModel();

            var editor = new Editor
            {
                Text = "",
                HorizontalOptions = LayoutOptions.FillAndExpand,
            };
            editor.SetBinding(Editor.TextProperty, "Message");
            var label = new Label
            {
                Text = "",
                FontSize = 30,
                HorizontalOptions = LayoutOptions.FillAndExpand,
            };
            label.SetBinding(Label.TextProperty, "Message");
            var sclabel = new Label
            {
                Text = "",
                FontSize = 30,
                HorizontalOptions = LayoutOptions.FillAndExpand,
            };
            sclabel.SetBinding(Label.TextProperty,
                new Binding("Message",
                    converter: new Converters.StringCaseConverter(),
                    converterParameter: "True"));
            var sllabel = new Label
            {
                Text = "",
                FontSize = 30,
                HorizontalOptions = LayoutOptions.FillAndExpand,
            };
            sllabel.SetBinding(Label.TextProperty,
                new Binding("Message",
                    converter: new Converters.StringToLengthConverter(),
                    stringFormat: "{0} letters"));

            var stack = new StackLayout
            {
                Spacing = 20,
                Children = {
                    editor,
                    label,
                    sclabel,
                    sllabel,
                },
            };

            Padding = 30;
            Title = "ViewModel bindig (C#)";
            Content = stack;
        }
开发者ID:zcccust,项目名称:Study,代码行数:53,代码来源:CSViewModelConverterPage.cs

示例14: NumberItemPage

        public NumberItemPage()
        {
            this.SetBinding(ContentPage.TitleProperty, "Name");

            var label = new Label
            {
                HorizontalOptions = LayoutOptions.Center,
                VerticalOptions = LayoutOptions.Center
            };
            label.SetBinding(Label.TextProperty, "Name");

            this.Content = label;
        }
开发者ID:mrlacey,项目名称:XamFormsControls,代码行数:13,代码来源:MyTabbedItemsPage.cs

示例15: FriendsListViewCell

 public FriendsListViewCell()
 {
     ch = new ColorHandler();
     Image userEmoji = new Image
     {
         Aspect = Aspect.AspectFit,
         WidthRequest = 50,
         HorizontalOptions = LayoutOptions.Center
     };
     userEmoji.SetBinding(Image.SourceProperty, "UserEmoji");
     var lUserName = new Label
     {
         HorizontalOptions = LayoutOptions.Center,
         VerticalOptions = LayoutOptions.Center
     };
     lUserName.SetBinding(Label.TextProperty, "Username");
     lUserName.SetBinding(Label.TextColorProperty, "Color", converter: new ColorConverter());
     Button friendshipIndicator = new Button // TODO: custom renderer
     {
         HeightRequest = 50,
         WidthRequest = 50,
         HorizontalOptions = LayoutOptions.CenterAndExpand,
         VerticalOptions = LayoutOptions.Center
     };
     friendshipIndicator.SetBinding(Button.BackgroundColorProperty, "SharedClubIndicator");
     View = new StackLayout
     {
         Children =
         {
             userEmoji,
             lUserName,
             friendshipIndicator
         },
         BackgroundColor = ch.fromStringToColor("white"),
         Orientation = StackOrientation.Horizontal,
         HorizontalOptions = LayoutOptions.CenterAndExpand
     };
 }
开发者ID:bpeck81,项目名称:Cloudclub_v1,代码行数:38,代码来源:FriendsListViewCell.cs


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