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


C# Label.WithPadding方法代码示例

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


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

示例1: SimplePushAlertView

		public SimplePushAlertView()
		{
			RowDefinitions = new RowDefinitionCollection
			{
				new RowDefinition {Height = new GridLength(1, GridUnitType.Auto)}
			};

			// Allow taps to pass through
			InputTransparent = true;

			if (Device.Idiom == TargetIdiom.Phone)
			{
				ColumnDefinitions = new ColumnDefinitionCollection
				{
					// Content
					new ColumnDefinition {Width = new GridLength(1, GridUnitType.Star)},
				};
			}
			else
			{
				ColumnDefinitions = new ColumnDefinitionCollection
				{
					// Spacer
					new ColumnDefinition {Width = new GridLength(1, GridUnitType.Star)},
					// Content
					new ColumnDefinition {Width = new GridLength(1, GridUnitType.Auto)},
					// Spacer
					new ColumnDefinition {Width = new GridLength(1, GridUnitType.Star)},
				};
			}

			_contentGrid = new Grid
			{
				RowDefinitions = new RowDefinitionCollection
				{
					new RowDefinition {Height = new GridLength(1, GridUnitType.Auto)},
					new RowDefinition {Height = new GridLength(1, GridUnitType.Auto)},
					new RowDefinition {Height = new GridLength(1, GridUnitType.Auto)}
				},
				ColumnDefinitions = new ColumnDefinitionCollection
				{
					new ColumnDefinition {Width = new GridLength(1, GridUnitType.Auto)},
					new ColumnDefinition {Width = new GridLength(1, GridUnitType.Auto)}
				},
				BackgroundColor = Color.Teal,
				InputTransparent = InputTransparent
			};

			// No spacers needed on phone
			_contentGrid.SetGridProperties(0, Device.Idiom == TargetIdiom.Phone ? 0 : 1);

			Children.Add(_contentGrid);

			_image = new Image
			{
				HeightRequest = 32,
				WidthRequest = 32,
				InputTransparent = InputTransparent
			};
			_contentGrid.Children.Add(_image
				.WithPadding(10)
				.SetGridProperties(0, 0, 2));

			_titleLabel = new Label
			{
				TextColor = Color.White,
				FontSize = 16,
				InputTransparent = InputTransparent
			};
			_contentGrid.Children.Add(_titleLabel
				.WithPadding(10, 10, 0, 0)
				.SetGridProperties(0, 1));

			_bodyLabel = new Label
			{
				TextColor = Color.White,
				FontSize = 12,
				WidthRequest = 320,
				InputTransparent = InputTransparent
			};
			_contentGrid.Children.Add(_bodyLabel
				.WithPadding(0, 10, 0, 0)
				.SetGridProperties(1, 1));

		}
开发者ID:Donky-Network,项目名称:DonkySDK-Xamarin-Modular,代码行数:85,代码来源:SimplePushAlertView.cs


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