public override void Draw(CGRect rect) { var context = UIGraphics.GetCurrentContext(); MessageBarStyleSheet styleSheet = StylesheetProvider; context.SaveState(); styleSheet.BackgroundColorForMessageType(MessageType).SetColor(); context.FillRect(rect); context.RestoreState(); context.SaveState(); context.BeginPath(); context.MoveTo(0, rect.Size.Height); context.SetStrokeColor(styleSheet.StrokeColorForMessageType(MessageType).CGColor); context.SetLineWidth(1); context.AddLineToPoint(rect.Size.Width, rect.Size.Height); context.StrokePath(); context.RestoreState(); context.SaveState(); float xOffset = Padding; float yOffset = Padding; var icon = styleSheet.IconImageForMessageType(MessageType); if (icon != null) { icon.Draw(new RectangleF(xOffset, yOffset, IconSize, IconSize)); } context.SaveState(); yOffset -= TextOffset; xOffset += (icon == null ? 0 : IconSize) + Padding; CGSize titleLabelSize = TitleSize(); if (string.IsNullOrEmpty(Title) && !string.IsNullOrEmpty(Description)) { yOffset = (float)(Math.Ceiling((double)rect.Size.Height * 0.5) - Math.Ceiling((double)titleLabelSize.Height * 0.5) - TextOffset); } TitleColor.SetColor(); var titleRectangle = new RectangleF(xOffset, yOffset, (float)titleLabelSize.Width + 5, (float)titleLabelSize.Height + 5); Title.DrawString(titleRectangle, new UIStringAttributes { Font = TitleFont, ForegroundColor = TitleColor }); yOffset += (float)titleLabelSize.Height; CGSize descriptionLabelSize = DescriptionSize(); DescriptionColor.SetColor(); var descriptionRectangle = new RectangleF(xOffset, yOffset, (float)descriptionLabelSize.Width + Padding, (float)descriptionLabelSize.Height); Description.DrawString(descriptionRectangle, new UIStringAttributes { Font = DescriptionFont, ForegroundColor = DescriptionColor }); }