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


C# Image.GetSizeRequest方法代码示例

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


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

示例1: TestAspectSizingWithConstrainedWidth

		public void TestAspectSizingWithConstrainedWidth ()
		{
			var image = new Image {Source = ImageSource.FromFile ("File.png"), Platform = new UnitPlatform (), IsPlatformEnabled = true};

			var result = image.GetSizeRequest (25, double.PositiveInfinity);

			Assert.AreEqual (25, result.Request.Width);
			Assert.AreEqual (5, result.Request.Height);
		}
开发者ID:Costo,项目名称:Xamarin.Forms,代码行数:9,代码来源:ImageTests.cs

示例2: TestSizing

		public void TestSizing ()
		{
			var image = new Image {Source = ImageSource.FromFile ("File.png"), Platform = new UnitPlatform (), IsPlatformEnabled = true};

			var result = image.GetSizeRequest (double.PositiveInfinity, double.PositiveInfinity);

			Assert.AreEqual (100, result.Request.Width);
			Assert.AreEqual (20, result.Request.Height);
		}
开发者ID:Costo,项目名称:Xamarin.Forms,代码行数:9,代码来源:ImageTests.cs

示例3: FootballPlayerListCell

        public FootballPlayerListCell()
        {
            FootballPlayer footballplayercollection = (FootballPlayer)this.BindingContext;
            var deleteAction = new MenuItem { Text = "", IsDestructive = true };
            deleteAction.Clicked += DeleteAction_Clicked;
            this.ContextActions.Add (deleteAction);
            deleteAction.Text = "Delete";
            var Favourites = new MenuItem { IsDestructive = false };
            Favourites.Clicked += Favourites_Clicked;
            FootballPlayer foot = new FootballPlayer ();
            if (foot.fav) {
                Favourites.Text = "UnFavourite";
            } else {
                Favourites.Text = "Mark Favourite";
            }
            this.ContextActions.Add (Favourites);

            nameLabel = new Label () {
                FontFamily = "HelveticaNeue-Medium",
                FontSize = 18,
                TextColor = Color.Black,

                WidthRequest = 100

            };

            var DOB = new Label () {
                FontFamily = "HelveticaNeue-Medium",
                FontSize = 18,
                TextColor = Color.Black,

                WidthRequest = 100
            };

            var ageLabel = new Label () {
                FontFamily = "HelveticaNeue-Medium",
                FontSize = 18,
                TextColor = Color.Black,
                Text = "age",
                WidthRequest = 100

            };

            var countryimg = new Image ();
            countryimg.SetBinding (Image.SourceProperty, "countryImage");
            countryimg.GetSizeRequest (15, 15);

            var Lname = new Label () {
                FontFamily = "HelveticaNeue-Medium",
                FontSize = 18,
                TextColor = Color.Black,

                WidthRequest = 100

            };

            nameLabel.SetBinding(Label.TextProperty,"PFName");
            DOB.SetBinding (Label.TextProperty, "PlayerAge");
            Lname.SetBinding (Label.TextProperty, "PLName");

            var cellLayout = new StackLayout {
                Spacing = 5,
                Padding = new Thickness (5, 5, 5, 5),

                Orientation = StackOrientation.Horizontal,
                HorizontalOptions = LayoutOptions.FillAndExpand,
                Children = { nameLabel, Lname ,

                new StackLayout {
                    Orientation = StackOrientation.Vertical,
                    Spacing = 5,
                        Children = { ageLabel, DOB }
                },

                    countryimg
                }
            };

            this.View = cellLayout;
        }
开发者ID:CTS458641,项目名称:cts458701,代码行数:80,代码来源:FootballPlayerListCell.cs

示例4: TestFillSizingWithConstrainedHeight

		public void TestFillSizingWithConstrainedHeight ()
		{
			var image = new Image {Source = ImageSource.FromFile ("File.png"), Platform = new UnitPlatform (), IsPlatformEnabled = true};

			image.Aspect = Aspect.AspectFill;
			var result = image.GetSizeRequest (double.PositiveInfinity, 10);

			Assert.AreEqual (50, result.Request.Width);
			Assert.AreEqual (10, result.Request.Height);
		}
开发者ID:Costo,项目名称:Xamarin.Forms,代码行数:10,代码来源:ImageTests.cs


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