當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。