本文整理汇总了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);
}
示例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);
}
示例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;
}
示例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);
}