protected override void OnRender(DrawingContext drawingContext)
        {
            base.OnRender(drawingContext);
            if (this.rangeRenderer == null)
            {
                this.rangeRenderer = new SuperRoundedRectRenderer();
            }
            Thickness rangeMargin = this.RangeMargin;
            Rect      rect        = RenderUtils.CalculateInnerRect(new Rect(0.0, 0.0, this.ActualWidth, this.ActualHeight), this.BorderWidth);
            Rect      renderRect  = new Rect(new Point(rect.Left + rangeMargin.Left, rect.Top + rect.Height - rangeMargin.Bottom - this.RangeHeight), new Point(rect.Left + rect.Width - rangeMargin.Right, rect.Top + rect.Height - rangeMargin.Bottom));

            this.rangeRenderer.Render(drawingContext, renderRect, this.RangeBrush, this.RangeCornerRadius);
        }
Exemple #2
0
        protected override void OnRender(DrawingContext drawingContext)
        {
            base.OnRender(drawingContext);
            if (this.ViewType != ChoiceEditorViewType.Combo || this.ShowFullControl)
            {
                return;
            }
            double      borderCornerRadius = this.BorderCornerRadius;
            Thickness   dropButtonInset    = this.DropButtonInset;
            Thickness   textAreaInset      = this.TextAreaInset;
            Brush       dropButtonBrush    = this.DropButtonBrush;
            double      innerCornerRadius  = this.InnerCornerRadius;
            ImageSource buttonIcon         = this.ButtonIcon;
            double      iconWidth          = this.IconWidth;
            double      iconHeight         = this.IconHeight;
            Rect        outerBounds        = new Rect(0.0, 0.0, this.ActualWidth, this.ActualHeight);

            if (!RenderUtils.DrawInscribedRoundedRect(drawingContext, this.BorderBrush, (Pen)null, outerBounds, borderCornerRadius))
            {
                return;
            }
            Rect   rect = RenderUtils.CalculateInnerRect(outerBounds, 0.0);
            double x1   = (rect.Right > textAreaInset.Right ? rect.Right - textAreaInset.Right : 0.0) + dropButtonInset.Left;
            double y1   = rect.Top + dropButtonInset.Top;
            double x2   = rect.Right - dropButtonInset.Right;
            double y2   = rect.Bottom - dropButtonInset.Bottom;

            RenderUtils.DrawInscribedRoundedRect(drawingContext, dropButtonBrush, (Pen)null, new Rect(new Point(x1, y1), new Point(x2, y2)), innerCornerRadius);
            if (buttonIcon != null)
            {
                double num1 = x1 + (x2 - x1) / 2.0;
                double num2 = y1 + (y2 - y1) / 2.0;
                drawingContext.DrawImage(buttonIcon, new Rect(new Point(num1 - iconWidth / 2.0, num2 - iconHeight / 2.0), new Point(num1 + iconWidth / 2.0, num2 + iconHeight / 2.0)));
            }
            double x3 = rect.Left + textAreaInset.Left;
            double y3 = rect.Top + textAreaInset.Top;
            double x4 = rect.Right > textAreaInset.Right ? rect.Right - textAreaInset.Right : x3;
            double y4 = rect.Bottom - textAreaInset.Bottom;

            RenderUtils.DrawInscribedRoundedRect(drawingContext, this.Background, (Pen)null, new Rect(new Point(x3, y3), new Point(x4, y4)), innerCornerRadius);
        }