本文整理汇总了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));
}