Esempio n. 1
0
		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);
		}
Esempio n. 2
0
		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);
		}
        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;
        }
Esempio n. 4
0
		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);
		}