本文整理汇总了C#中Xamarin.Forms.Label.GetSizeRequest方法的典型用法代码示例。如果您正苦于以下问题:C# Label.GetSizeRequest方法的具体用法?C# Label.GetSizeRequest怎么用?C# Label.GetSizeRequest使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Xamarin.Forms.Label
的用法示例。
在下文中一共展示了Label.GetSizeRequest方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: FontCalc
public FontCalc(Label label, double fontSize, double containerWidth)
: this()
{
// Save the font size.
FontSize = fontSize;
// Recalculate the Label height.
label.FontSize = fontSize;
SizeRequest sizeRequest = label.GetSizeRequest(containerWidth, Double.PositiveInfinity);
// Save that height.
TextHeight = sizeRequest.Request.Height;
TextWidth = sizeRequest.Request.Width;
}
示例2: StockStatsPage
public StockStatsPage (string stockTicker)
{
var stock = new ChartingAndComparingPrices.ComparingStocks (stockTicker, new DateTime (2014, 1, 1), DateTime.Now);
RelativeLayout relativeLayout = new RelativeLayout ();
#region Views
var largeTicker = new Label {
Text = stockTicker.ToUpper (),
FontSize = 30,
FontAttributes = FontAttributes.Bold,
HorizontalOptions = LayoutOptions.CenterAndExpand,
TextColor = MyColors.Clouds,
WidthRequest = 50,
HeightRequest = 25
};
var standDevLabel = new Label {
Text = "Standard Deviation",
HorizontalOptions = LayoutOptions.CenterAndExpand,
TextColor = MyColors.Clouds
};
var standDevNumber = new Label {
Text = "$" + System.Math.Round (stock.StandardDev, 2).ToString (),
HorizontalOptions = LayoutOptions.CenterAndExpand, TextColor = MyColors.Turqoise
};
var basicStatsLabel = new Label {
Text = "Basic Statistics using Math.Net",
HorizontalOptions = LayoutOptions.CenterAndExpand,
TextColor = MyColors.Clouds
};
var meanLabel = new Label {
Text = "Mean: ",
HorizontalOptions = LayoutOptions.Start, TextColor = MyColors.Clouds
};
var mean = new Label {
Text = "$" + System.Math.Round (stock.Mean, 2).ToString (),
TextColor = MyColors.Turqoise
};
var maxLabel = new Label {
Text = "Max: ",
HorizontalOptions = LayoutOptions.Start, TextColor = MyColors.Clouds
};
var max = new Label {
Text = "$" + System.Math.Round (stock.Max, 2),
TextColor = MyColors.Turqoise
};
var minLabel = new Label {
Text = "Min: ",
HorizontalOptions = LayoutOptions.Start, TextColor = MyColors.Clouds
};
var min = new Label {
Text = "$" + System.Math.Round (stock.Min, 2),
TextColor = MyColors.Turqoise
};
var stdLabel = new Label {
Text = "StdDev: ",
HorizontalOptions = LayoutOptions.Start, TextColor = MyColors.Clouds
};
var stdDev = new Label {
Text = "$" + System.Math.Round (stock.StandardDev, 2).ToString (),
TextColor = MyColors.Turqoise
};
var boxView = new BoxView ();
boxView.HeightRequest = 2;
boxView.WidthRequest = App.ScreenWidth;
boxView.Color = MyColors.Concrete;
var boxView0 = new BoxView ();
boxView0.HeightRequest = 1;
boxView0.WidthRequest = App.ScreenWidth;
boxView0.Color = MyColors.Concrete;
var boxView1 = new BoxView ();
boxView1.HeightRequest = 1;
boxView1.WidthRequest = App.ScreenWidth;
boxView1.Color = MyColors.Concrete;
#endregion
#region Find view sizes
Func<RelativeLayout, double> standDevLabelWidth = (p) => standDevLabel.GetSizeRequest (relativeLayout.Width, relativeLayout.Height).Request.Width;
Func<RelativeLayout, double> standDevNumberWidth = (p) => standDevNumber.GetSizeRequest (relativeLayout.Width, relativeLayout.Height).Request.Width;
Func<RelativeLayout, double> standDevNumberHeight = (p) => standDevNumber.GetSizeRequest (relativeLayout.Width, relativeLayout.Height).Request.Height;
Func<RelativeLayout, double> meanNumberWidth = (p) => mean.GetSizeRequest (relativeLayout.Width, relativeLayout.Height).Request.Width;
Func<RelativeLayout, double> largeTickerWidth = (p) => largeTicker.GetSizeRequest (relativeLayout.Width, relativeLayout.Height).Request.Width;
//.........这里部分代码省略.........