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


C# Image.SetBinding方法代码示例

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


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

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

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

            public MyCell()
            {
                //画像
                var picture = new Image() { Aspect = Aspect.AspectFit, WidthRequest = 50,HeightRequest=50 };
                picture.VerticalOptions = LayoutOptions.Start;//アイコンを行の上に詰めて表示
                picture.SetBinding(Image.SourceProperty, "Picture");

                //いいね数
                var likes = new Label { Font = Font.SystemFontOfSize(10), TextColor = Color.Black };
                likes.HeightRequest = 50;
                likes.YAlign = TextAlignment.Center;
                likes.SetBinding(Label.TextProperty, "Likes");

                var pictureLike = new Image() { Aspect = Aspect.AspectFit, WidthRequest = 60 };
                //picture.VerticalOptions = LayoutOptions.Start;//アイコンを行の上に詰めて表示
                pictureLike.Source = ImageSource.FromResource("FbSample.image.like.png");

                //いいね行
                var likesSub = new StackLayout {
                    Orientation = StackOrientation.Horizontal, //横に並べる
                    Children = { likes, pictureLike }
                };

                View = new StackLayout {
                    Padding = new Thickness(5),
                    Orientation = StackOrientation.Horizontal, //横に並べる
                    Children = { picture, likesSub} //アイコンとサブレイアウトを横に並べる
                };
            }
开发者ID:furuya02,项目名称:FbSample,代码行数:29,代码来源:LikesPage.cs

示例4: MyCell

            public MyCell()
            {
                //画像
                var picture = new Image() { Aspect = Aspect.AspectFit, WidthRequest = 100, HeightRequest = 100};
                picture.VerticalOptions = LayoutOptions.Start;//アイコンを行の上に詰めて表示
                picture.SetBinding(Image.SourceProperty, "Picture");

                var createTime = new Label { Font = Font.SystemFontOfSize(10), TextColor = Color.Gray };
                createTime.SetBinding(Label.TextProperty, "CreateTime");

                var message = new Label { Font = Font.SystemFontOfSize(10), TextColor = Color.Black };
                message.SetBinding(Label.TextProperty, "Message");

                var url = new Label { Font = Font.SystemFontOfSize(9), TextColor = Color.Black };
                url.SetBinding(Label.TextProperty, "Url");

                //いいね行
                var likesSub = new StackLayout {
                    //Orientation = StackOrientation.Horizontal, //横に並べる
                    Children = { message,createTime,url }
                };

                View = new StackLayout {
                    Padding = new Thickness(5),
                    Orientation = StackOrientation.Horizontal, //横に並べる
                    Children = { picture, likesSub }
                };
            }
开发者ID:furuya02,项目名称:FbSample,代码行数:28,代码来源:NicePage.cs

示例5: CustomVeggieCell

			public CustomVeggieCell()
			{
				//instantiate each of our views
				var image = new Image();
				var nameLabel = new Label();
				var typeLabel = new Label();
				var verticaLayout = new StackLayout();
				var horizontalLayout = new StackLayout() { BackgroundColor = Color.Olive };

				//set bindings
				nameLabel.SetBinding(Label.TextProperty, new Binding("Name"));
				typeLabel.SetBinding(Label.TextProperty, new Binding("Type"));
				image.SetBinding(Image.SourceProperty, new Binding("Image"));

				//Set properties for desired design
				horizontalLayout.Orientation = StackOrientation.Horizontal;
				horizontalLayout.HorizontalOptions = LayoutOptions.Fill;
				image.HorizontalOptions = LayoutOptions.End;
				nameLabel.FontSize = 24;

				//add views to the view hierarchy
				verticaLayout.Children.Add(nameLabel);
				verticaLayout.Children.Add(typeLabel);
				horizontalLayout.Children.Add(verticaLayout);
				horizontalLayout.Children.Add(image);
				
				// add to parent view
				View = horizontalLayout;
			}
开发者ID:berlamont,项目名称:xamarin-forms-samples,代码行数:29,代码来源:MainViewCode.cs

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

示例7: CustomMenuItemCell

        public CustomMenuItemCell()
        {

            CustomLayout masterLayout = new CustomLayout();
            masterLayout.BackgroundColor = Constants.MENU_BG_COLOR;
            //IDeviceSpec deviceSpec = DependencyService.Get<IDeviceSpec>();
            double screenWidth = App.screenWidth;
            double screenHeight = App.screenHeight;
            Label name = new Label();
            name.SetBinding(Label.TextProperty, "Name");
            name.TextColor = Constants.MAIN_MENU_TEXT_COLOR;//Color.Black;
            name.FontFamily = Constants.HELVERTICA_NEUE_LT_STD;
            name.FontSize = Device.OnPlatform(12, 17, 18);

            StackLayout divider = new StackLayout();
            divider.WidthRequest = screenWidth;
            divider.HeightRequest = .75;
            divider.BackgroundColor = Color.FromRgb(255, 255, 255);

            Image sideImage = new Image();
            sideImage.WidthRequest = 25;
            sideImage.HeightRequest = 25;
            sideImage.SetBinding(Image.SourceProperty, "ImageName");
            sideImage.Aspect = Aspect.Fill;

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

            masterLayout.AddChildToLayout(sideImage, (float)5, (float)Device.OnPlatform(5, 0, 50), (int)masterLayout.WidthRequest, (int)masterLayout.HeightRequest);
			masterLayout.AddChildToLayout(name, (float)Device.OnPlatform( 15, 15 , 15 ), (float)Device.OnPlatform(5, 0, 50), (int)masterLayout.WidthRequest, (int)masterLayout.HeightRequest);
           // masterLayout.AddChildToLayout(divider, (float)1, (float)20, (int)masterLayout.WidthRequest, (int)masterLayout.HeightRequest);
            this.View = masterLayout;
        }
开发者ID:praveenmohanmm,项目名称:PurposeColor_Bkp_Code,代码行数:33,代码来源:MenuPage.cs

示例8: MovieItemTemplate

        public MovieItemTemplate()
        {
            StackLayout outStack = new StackLayout (){
                Orientation=StackOrientation.Horizontal,
                HorizontalOptions=LayoutOptions.Fill
            };
            StackLayout inStack = new StackLayout (){
                Orientation=StackOrientation.Vertical,
                HorizontalOptions=LayoutOptions.CenterAndExpand
            };
            Label title = new Label {
                FontSize=20,
                HorizontalOptions=LayoutOptions.Center
            };

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

            Label description = new Label {
                FontSize=12,
                HorizontalOptions=LayoutOptions.Center
            };

            description.SetBinding (Label.TextProperty, "Year");

            Image image = new Image ();
            image.SetBinding (Image.SourceProperty, "Image");

            inStack.Children.Add (title);
            inStack.Children.Add (description);
            outStack.Children.Add (image);
            outStack.Children.Add (inStack);
            View = outStack;
        }
开发者ID:jamesqquick,项目名称:XamarinForms,代码行数:33,代码来源:MovieItemTemplate.cs

示例9: SpeakerDetailPage

        public SpeakerDetailPage(){
            NavigationPage.SetHasNavigationBar(this, true);
            BackgroundColor = Color.White;

            var nameLabel = new Label { TextColor = Color.Gray };
            nameLabel.SetBinding(Label.TextProperty, new Binding("Nombre"));

            var empresaLabel = new Label { TextColor = Color.Gray };
            empresaLabel.SetBinding(Label.TextProperty, new Binding("Empresa"));

            var twitterLabel = new Label { TextColor = Color.Gray };
            twitterLabel.SetBinding(Label.TextProperty, new Binding("Twitter"));

            var fotoImage = new Image ();
            fotoImage.SetBinding(Image.SourceProperty, new Binding("Foto"));

            Content = new StackLayout
            {
                VerticalOptions = LayoutOptions.StartAndExpand,
                Padding = 10,
                Children = { 
                    nameLabel,
                    empresaLabel,
                    twitterLabel,
                    fotoImage
                }
            };

        }
开发者ID:palaniakasapu,项目名称:Xamarin,代码行数:29,代码来源:SpeakerDetailPage.cs

示例10: TodoItemCell

		public TodoItemCell ()
		{
			// BackgroundColor = Color.Aqua;

			var label = new Label {
				YAlign = TextAlignment.Center
			};

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

			var tick = new Image {
				Source = FileImageSource.FromFile ("check2.png")
			};
				tick.SetBinding (Image.IsVisibleProperty, "Done");
			//tick.SetBinding (Image.IsVisibleProperty, "Remarks");

			var layout = new StackLayout {
				Padding = new Thickness (20, 0, 0, 0),
				Orientation = StackOrientation.Horizontal,
				HorizontalOptions = LayoutOptions.StartAndExpand,
				Children = { label, tick }
			};

			View = layout;
		}
开发者ID:09037497,项目名称:IAB330Group,代码行数:25,代码来源:TodoItemCell.cs

示例11: SearchPageCell

        public SearchPageCell()
        {
            var itemName = new Label {
                YAlign = TextAlignment.Center,
                FontSize = 20,
                TextColor = Color.Black
            };
            itemName.SetBinding (Label.TextProperty, "ItemName");

            var itemPrice = new Label {
               // HorizontalOptions = LayoutOptions.CenterAndExpand,
               HorizontalOptions = LayoutOptions.EndAndExpand,
               YAlign = TextAlignment.Center,
                TextColor = Color.Black,
               FontSize = 16
            };

            itemPrice.SetBinding(Label.TextProperty, "ItemPriceString");

            var itemImage = new Image {

            };
            itemImage.SetBinding(Image.SourceProperty, "ItemPicture");

            var layout = new StackLayout {
                Padding = new Thickness(20, 0, 0, 0),
                Orientation = StackOrientation.Horizontal,
                HorizontalOptions = LayoutOptions.StartAndExpand,
                Children = {itemImage, itemName, itemPrice}
            };
            View = layout;
        }
开发者ID:boxuanzhang,项目名称:woolies,代码行数:32,代码来源:SearchPageCell.cs

示例12: 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.FromHex("111111")
              };
              nameLabel.SetBinding(Label.TextProperty, "Title");

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

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

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

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


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