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


C# BoxView.GetSizeRequest方法代码示例

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


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

示例1: 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;
//.........这里部分代码省略.........
开发者ID:IanLeatherbury,项目名称:tryfsharpforms,代码行数:101,代码来源:StockStatsPage.cs


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