本文整理匯總了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;
//.........這裏部分代碼省略.........