Exemplo n.º 1
0
        public override void Draw(RectangleF bounds, MonoTouch.CoreGraphics.CGContext context, UIView view)
        {
            CaptionColor.SetColor();
            var textHeight = Caption.MonoStringHeight(CaptionFont, bounds.Width - PaddingX * 2);

            view.DrawString(Caption, new RectangleF(PaddingX, Padding, bounds.Width - Padding * 2, bounds.Height - Padding * 2), CaptionFont, UILineBreakMode.WordWrap);

            if (Value != null)
            {
                ValueColor.SetColor();
                var valueHeight = Value.MonoStringHeight(ValueFont, bounds.Width - PaddingX * 2);
                view.DrawString(Value, new RectangleF(PaddingX, Padding + textHeight + 6f, bounds.Width - Padding * 2, valueHeight), ValueFont, UILineBreakMode.WordWrap);
            }
        }
Exemplo n.º 2
0
        public override void Draw(CGRect bounds, CoreGraphics.CGContext context, UIView view)
        {
            view.BackgroundColor = UIColor.White;
            CaptionColor.SetColor();
            var width      = bounds.Width - PaddingX * 2;
            var textHeight = Caption.MonoStringHeight(CaptionFont, width);

            Caption.DrawString(new CGRect(PaddingX, PaddingY, width, bounds.Height - PaddingY * 2), CaptionFont, UILineBreakMode.WordWrap);

            if (Value != null)
            {
                ValueColor.SetColor();
                var valueOrigin = new CGPoint(PaddingX, PaddingY + textHeight + 8f);
                var valueSize   = new CGSize(width, bounds.Height - valueOrigin.Y);
                Value.DrawString(new CGRect(valueOrigin, valueSize), ValueFont, UILineBreakMode.WordWrap);
            }
        }
Exemplo n.º 3
0
        public override float Height(System.Drawing.RectangleF bounds)
        {
            var width = bounds.Width;

            if (IsTappedAssigned)
            {
                width -= 20f;
            }

            var textHeight = Caption.MonoStringHeight(CaptionFont, width - PaddingX * 2);

            if (Value != null)
            {
                textHeight += 6f;
                textHeight += Value.MonoStringHeight(ValueFont, width - PaddingX * 2);
            }

            return(textHeight + Padding * 2);
        }
Exemplo n.º 4
0
        public override nfloat Height(CGRect bounds)
        {
            var width = bounds.Width - PaddingX * 2;

            if (Accessory != UITableViewCellAccessory.None)
            {
                width -= 20f;
            }

            var textHeight = Caption.MonoStringHeight(CaptionFont, width);

            if (Value != null)
            {
                textHeight += 6f;
                textHeight += Value.MonoStringHeight(ValueFont, width);
            }

            return((int)Math.Ceiling(textHeight + PaddingY * 2) + 1);
        }
Exemplo n.º 5
0
        public override float Height(UITableView tableView, CGRect bounds)
        {
            var cell = GetCell(tableView);

            cell.Bounds = new CGRect(0, 0, bounds.Width, 44f);
            cell.SetNeedsLayout();
            cell.LayoutIfNeeded();

            var contentWidth = cell.ContentView.Bounds.Width;
            var width        = contentWidth - PaddingX * 2;
            var textHeight   = Caption.MonoStringHeight(CaptionFont, width);

            if (Value != null)
            {
                textHeight += 6f;
                textHeight += Value.MonoStringHeight(ValueFont, width);
            }

            var height = (int)Math.Ceiling(textHeight + PaddingY * 2) + 1;

            return(height);
        }