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)); }