Ejemplo n.º 1
0
        private void RenderTheme(DrawingContext dc)
        {
            Size size        = RenderSize;
            bool horizontal  = Orientation == Orientation.Horizontal;
            bool isClickable = IsClickable && IsEnabled;
            bool isHovered   = isClickable && IsHovered;
            bool isPressed   = isClickable && IsPressed;
            ListSortDirection?sortDirection = SortDirection;
            bool isSorted   = sortDirection != null;
            bool isSelected = IsSelected;
            bool hasBevel   = (!isHovered && !isPressed && !isSorted && !isSelected);

            EnsureCache((int)AeroFreezables.NumFreezables);

            if (horizontal)
            {
                // When horizontal, rotate the rendering by -90 degrees
                Matrix m1 = new Matrix();
                m1.RotateAt(-90.0, 0.0, 0.0);
                Matrix m2 = new Matrix();
                m2.Translate(0.0, size.Height);

                MatrixTransform horizontalRotate = new MatrixTransform(m1 * m2);
                horizontalRotate.Freeze();
                dc.PushTransform(horizontalRotate);

                double temp = size.Width;
                size.Width  = size.Height;
                size.Height = temp;
            }

            if (hasBevel)
            {
                // This is a highlight that can be drawn by just filling the background with the color.
                // It will be seen through the gab between the border and the background.
                LinearGradientBrush bevel = (LinearGradientBrush)GetCachedFreezable((int)AeroFreezables.NormalBevel);
                if (bevel == null)
                {
                    bevel            = new LinearGradientBrush();
                    bevel.StartPoint = new Point();
                    bevel.EndPoint   = new Point(0.0, 1.0);
                    bevel.GradientStops.Add(new GradientStop(Color.FromArgb(0xFF, 0xFF, 0xFF, 0xFF), 0.0));
                    bevel.GradientStops.Add(new GradientStop(Color.FromArgb(0xFF, 0xFF, 0xFF, 0xFF), 0.4));
                    bevel.GradientStops.Add(new GradientStop(Color.FromArgb(0xFF, 0xFC, 0xFC, 0xFD), 0.4));
                    bevel.GradientStops.Add(new GradientStop(Color.FromArgb(0xFF, 0xFB, 0xFC, 0xFC), 1.0));
                    bevel.Freeze();

                    CacheFreezable(bevel, (int)AeroFreezables.NormalBevel);
                }

                dc.DrawRectangle(bevel, null, new Rect(0.0, 0.0, size.Width, size.Height));
            }

            // Fill the background
            AeroFreezables backgroundType = AeroFreezables.NormalBackground;

            if (isPressed)
            {
                backgroundType = AeroFreezables.PressedBackground;
            }
            else if (isHovered)
            {
                backgroundType = AeroFreezables.HoveredBackground;
            }
            else if (isSorted || isSelected)
            {
                backgroundType = AeroFreezables.SortedBackground;
            }

            LinearGradientBrush background = (LinearGradientBrush)GetCachedFreezable((int)backgroundType);

            if (background == null)
            {
                background            = new LinearGradientBrush();
                background.StartPoint = new Point();
                background.EndPoint   = new Point(0.0, 1.0);

                switch (backgroundType)
                {
                case AeroFreezables.NormalBackground:
                    background.GradientStops.Add(new GradientStop(Color.FromArgb(0xFF, 0xFF, 0xFF, 0xFF), 0.0));
                    background.GradientStops.Add(new GradientStop(Color.FromArgb(0xFF, 0xFF, 0xFF, 0xFF), 0.4));
                    background.GradientStops.Add(new GradientStop(Color.FromArgb(0xFF, 0xF7, 0xF8, 0xFA), 0.4));
                    background.GradientStops.Add(new GradientStop(Color.FromArgb(0xFF, 0xF1, 0xF2, 0xF4), 1.0));
                    break;

                case AeroFreezables.PressedBackground:
                    background.GradientStops.Add(new GradientStop(Color.FromArgb(0xFF, 0xBC, 0xE4, 0xF9), 0.0));
                    background.GradientStops.Add(new GradientStop(Color.FromArgb(0xFF, 0xBC, 0xE4, 0xF9), 0.4));
                    background.GradientStops.Add(new GradientStop(Color.FromArgb(0xFF, 0x8D, 0xD6, 0xF7), 0.4));
                    background.GradientStops.Add(new GradientStop(Color.FromArgb(0xFF, 0x8A, 0xD1, 0xF5), 1.0));
                    break;

                case AeroFreezables.HoveredBackground:
                    background.GradientStops.Add(new GradientStop(Color.FromArgb(0xFF, 0xE3, 0xF7, 0xFF), 0.0));
                    background.GradientStops.Add(new GradientStop(Color.FromArgb(0xFF, 0xE3, 0xF7, 0xFF), 0.4));
                    background.GradientStops.Add(new GradientStop(Color.FromArgb(0xFF, 0xBD, 0xED, 0xFF), 0.4));
                    background.GradientStops.Add(new GradientStop(Color.FromArgb(0xFF, 0xB7, 0xE7, 0xFB), 1.0));
                    break;

                case AeroFreezables.SortedBackground:
                    background.GradientStops.Add(new GradientStop(Color.FromArgb(0xFF, 0xF2, 0xF9, 0xFC), 0.0));
                    background.GradientStops.Add(new GradientStop(Color.FromArgb(0xFF, 0xF2, 0xF9, 0xFC), 0.4));
                    background.GradientStops.Add(new GradientStop(Color.FromArgb(0xFF, 0xE1, 0xF1, 0xF9), 0.4));
                    background.GradientStops.Add(new GradientStop(Color.FromArgb(0xFF, 0xD8, 0xEC, 0xF6), 1.0));
                    break;
                }

                background.Freeze();

                CacheFreezable(background, (int)backgroundType);
            }

            dc.DrawRectangle(background, null, new Rect(0.0, 0.0, size.Width, size.Height));

            if (size.Width >= 2.0)
            {
                // Draw the borders on the sides
                AeroFreezables sideType = AeroFreezables.NormalSides;
                if (isPressed)
                {
                    sideType = AeroFreezables.PressedSides;
                }
                else if (isHovered)
                {
                    sideType = AeroFreezables.HoveredSides;
                }
                else if (isSorted || isSelected)
                {
                    sideType = AeroFreezables.SortedSides;
                }

                if (SeparatorVisibility == Visibility.Visible)
                {
                    Brush sideBrush;
                    if (SeparatorBrush != null)
                    {
                        sideBrush = SeparatorBrush;
                    }
                    else
                    {
                        sideBrush = (Brush)GetCachedFreezable((int)sideType);
                        if (sideBrush == null)
                        {
                            LinearGradientBrush lgBrush = null;
                            if (sideType != AeroFreezables.SortedSides)
                            {
                                lgBrush            = new LinearGradientBrush();
                                lgBrush.StartPoint = new Point();
                                lgBrush.EndPoint   = new Point(0.0, 1.0);
                                sideBrush          = lgBrush;
                            }

                            switch (sideType)
                            {
                            case AeroFreezables.NormalSides:
                                lgBrush.GradientStops.Add(new GradientStop(Color.FromArgb(0xFF, 0xF2, 0xF2, 0xF2), 0.0));
                                lgBrush.GradientStops.Add(new GradientStop(Color.FromArgb(0xFF, 0xEF, 0xEF, 0xEF), 0.4));
                                lgBrush.GradientStops.Add(new GradientStop(Color.FromArgb(0xFF, 0xE7, 0xE8, 0xEA), 0.4));
                                lgBrush.GradientStops.Add(new GradientStop(Color.FromArgb(0xFF, 0xDE, 0xDF, 0xE1), 1.0));
                                break;

                            case AeroFreezables.PressedSides:
                                lgBrush.GradientStops.Add(new GradientStop(Color.FromArgb(0xFF, 0x7A, 0x9E, 0xB1), 0.0));
                                lgBrush.GradientStops.Add(new GradientStop(Color.FromArgb(0xFF, 0x7A, 0x9E, 0xB1), 0.4));
                                lgBrush.GradientStops.Add(new GradientStop(Color.FromArgb(0xFF, 0x50, 0x91, 0xAF), 0.4));
                                lgBrush.GradientStops.Add(new GradientStop(Color.FromArgb(0xFF, 0x4D, 0x8D, 0xAD), 1.0));
                                break;

                            case AeroFreezables.HoveredSides:
                                lgBrush.GradientStops.Add(new GradientStop(Color.FromArgb(0xFF, 0x88, 0xCB, 0xEB), 0.0));
                                lgBrush.GradientStops.Add(new GradientStop(Color.FromArgb(0xFF, 0x88, 0xCB, 0xEB), 0.4));
                                lgBrush.GradientStops.Add(new GradientStop(Color.FromArgb(0xFF, 0x69, 0xBB, 0xE3), 0.4));
                                lgBrush.GradientStops.Add(new GradientStop(Color.FromArgb(0xFF, 0x69, 0xBB, 0xE3), 1.0));
                                break;

                            case AeroFreezables.SortedSides:
                                sideBrush = new SolidColorBrush(Color.FromArgb(0xFF, 0x96, 0xD9, 0xF9));
                                break;
                            }

                            sideBrush.Freeze();

                            CacheFreezable(sideBrush, (int)sideType);
                        }
                    }

                    dc.DrawRectangle(sideBrush, null, new Rect(0.0, 0.0, 1.0, Max0(size.Height - 0.95)));
                    dc.DrawRectangle(sideBrush, null, new Rect(size.Width - 1.0, 0.0, 1.0, Max0(size.Height - 0.95)));
                }
            }

            if (isPressed && (size.Width >= 4.0) && (size.Height >= 4.0))
            {
                // When pressed, there are added borders on the left and top
                LinearGradientBrush topBrush = (LinearGradientBrush)GetCachedFreezable((int)AeroFreezables.PressedTop);
                if (topBrush == null)
                {
                    topBrush            = new LinearGradientBrush();
                    topBrush.StartPoint = new Point();
                    topBrush.EndPoint   = new Point(0.0, 1.0);
                    topBrush.GradientStops.Add(new GradientStop(Color.FromArgb(0xFF, 0x86, 0xA3, 0xB2), 0.0));
                    topBrush.GradientStops.Add(new GradientStop(Color.FromArgb(0xFF, 0x86, 0xA3, 0xB2), 0.1));
                    topBrush.GradientStops.Add(new GradientStop(Color.FromArgb(0xFF, 0xAA, 0xCE, 0xE1), 0.9));
                    topBrush.GradientStops.Add(new GradientStop(Color.FromArgb(0xFF, 0xAA, 0xCE, 0xE1), 1.0));
                    topBrush.Freeze();

                    CacheFreezable(topBrush, (int)AeroFreezables.PressedTop);
                }

                dc.DrawRectangle(topBrush, null, new Rect(0.0, 0.0, size.Width, 2.0));

                LinearGradientBrush pressedBevel = (LinearGradientBrush)GetCachedFreezable((int)AeroFreezables.PressedBevel);
                if (pressedBevel == null)
                {
                    pressedBevel            = new LinearGradientBrush();
                    pressedBevel.StartPoint = new Point();
                    pressedBevel.EndPoint   = new Point(0.0, 1.0);
                    pressedBevel.GradientStops.Add(new GradientStop(Color.FromArgb(0xFF, 0xA2, 0xCB, 0xE0), 0.0));
                    pressedBevel.GradientStops.Add(new GradientStop(Color.FromArgb(0xFF, 0xA2, 0xCB, 0xE0), 0.4));
                    pressedBevel.GradientStops.Add(new GradientStop(Color.FromArgb(0xFF, 0x72, 0xBC, 0xDF), 0.4));
                    pressedBevel.GradientStops.Add(new GradientStop(Color.FromArgb(0xFF, 0x6E, 0xB8, 0xDC), 1.0));
                    pressedBevel.Freeze();

                    CacheFreezable(pressedBevel, (int)AeroFreezables.PressedBevel);
                }

                dc.DrawRectangle(pressedBevel, null, new Rect(1.0, 0.0, 1.0, size.Height - 0.95));
                dc.DrawRectangle(pressedBevel, null, new Rect(size.Width - 2.0, 0.0, 1.0, size.Height - 0.95));
            }

            if (size.Height >= 2.0)
            {
                // Draw the bottom border
                AeroFreezables bottomType = AeroFreezables.NormalBottom;
                if (isPressed)
                {
                    bottomType = AeroFreezables.PressedOrHoveredBottom;
                }
                else if (isHovered)
                {
                    bottomType = AeroFreezables.PressedOrHoveredBottom;
                }
                else if (isSorted || isSelected)
                {
                    bottomType = AeroFreezables.SortedBottom;
                }

                SolidColorBrush bottomBrush = (SolidColorBrush)GetCachedFreezable((int)bottomType);
                if (bottomBrush == null)
                {
                    switch (bottomType)
                    {
                    case AeroFreezables.NormalBottom:
                        bottomBrush = new SolidColorBrush(Color.FromArgb(0xFF, 0xD5, 0xD5, 0xD5));
                        break;

                    case AeroFreezables.PressedOrHoveredBottom:
                        bottomBrush = new SolidColorBrush(Color.FromArgb(0xFF, 0x93, 0xC9, 0xE3));
                        break;

                    case AeroFreezables.SortedBottom:
                        bottomBrush = new SolidColorBrush(Color.FromArgb(0xFF, 0x96, 0xD9, 0xF9));
                        break;
                    }

                    bottomBrush.Freeze();

                    CacheFreezable(bottomBrush, (int)bottomType);
                }

                dc.DrawRectangle(bottomBrush, null, new Rect(0.0, size.Height - 1.0, size.Width, 1.0));
            }

            if (isSorted && (size.Width > 14.0) && (size.Height > 10.0))
            {
                // Draw the sort arrow
                TranslateTransform positionTransform = new TranslateTransform((size.Width - 8.0) * 0.5, 1.0);
                positionTransform.Freeze();
                dc.PushTransform(positionTransform);

                bool         ascending     = (sortDirection == ListSortDirection.Ascending);
                PathGeometry arrowGeometry = (PathGeometry)GetCachedFreezable(ascending ? (int)AeroFreezables.ArrowUpGeometry : (int)AeroFreezables.ArrowDownGeometry);
                if (arrowGeometry == null)
                {
                    arrowGeometry = new PathGeometry();
                    PathFigure arrowFigure = new PathFigure();

                    if (ascending)
                    {
                        arrowFigure.StartPoint = new Point(0.0, 4.0);

                        LineSegment line = new LineSegment(new Point(4.0, 0.0), false);
                        line.Freeze();
                        arrowFigure.Segments.Add(line);

                        line = new LineSegment(new Point(8.0, 4.0), false);
                        line.Freeze();
                        arrowFigure.Segments.Add(line);
                    }
                    else
                    {
                        arrowFigure.StartPoint = new Point(0.0, 0.0);

                        LineSegment line = new LineSegment(new Point(8.0, 0.0), false);
                        line.Freeze();
                        arrowFigure.Segments.Add(line);

                        line = new LineSegment(new Point(4.0, 4.0), false);
                        line.Freeze();
                        arrowFigure.Segments.Add(line);
                    }

                    arrowFigure.IsClosed = true;
                    arrowFigure.Freeze();

                    arrowGeometry.Figures.Add(arrowFigure);
                    arrowGeometry.Freeze();

                    CacheFreezable(arrowGeometry, ascending ? (int)AeroFreezables.ArrowUpGeometry : (int)AeroFreezables.ArrowDownGeometry);
                }

                // Draw two arrows, one inset in the other. This is to achieve a double gradient over both the border and the fill.
                LinearGradientBrush arrowBorder = (LinearGradientBrush)GetCachedFreezable((int)AeroFreezables.ArrowBorder);
                if (arrowBorder == null)
                {
                    arrowBorder            = new LinearGradientBrush();
                    arrowBorder.StartPoint = new Point();
                    arrowBorder.EndPoint   = new Point(1.0, 1.0);
                    arrowBorder.GradientStops.Add(new GradientStop(Color.FromArgb(0xFF, 0x3C, 0x5E, 0x72), 0.0));
                    arrowBorder.GradientStops.Add(new GradientStop(Color.FromArgb(0xFF, 0x3C, 0x5E, 0x72), 0.1));
                    arrowBorder.GradientStops.Add(new GradientStop(Color.FromArgb(0xFF, 0xC3, 0xE4, 0xF5), 1.0));
                    arrowBorder.Freeze();
                    CacheFreezable(arrowBorder, (int)AeroFreezables.ArrowBorder);
                }

                dc.DrawGeometry(arrowBorder, null, arrowGeometry);

                LinearGradientBrush arrowFill = (LinearGradientBrush)GetCachedFreezable((int)AeroFreezables.ArrowFill);
                if (arrowFill == null)
                {
                    arrowFill            = new LinearGradientBrush();
                    arrowFill.StartPoint = new Point();
                    arrowFill.EndPoint   = new Point(1.0, 1.0);
                    arrowFill.GradientStops.Add(new GradientStop(Color.FromArgb(0xFF, 0x61, 0x96, 0xB6), 0.0));
                    arrowFill.GradientStops.Add(new GradientStop(Color.FromArgb(0xFF, 0x61, 0x96, 0xB6), 0.1));
                    arrowFill.GradientStops.Add(new GradientStop(Color.FromArgb(0xFF, 0xCA, 0xE6, 0xF5), 1.0));
                    arrowFill.Freeze();
                    CacheFreezable(arrowFill, (int)AeroFreezables.ArrowFill);
                }

                // Inset the fill arrow inside the border arrow
                ScaleTransform arrowScale = (ScaleTransform)GetCachedFreezable((int)AeroFreezables.ArrowFillScale);
                if (arrowScale == null)
                {
                    arrowScale = new ScaleTransform(0.75, 0.75, 3.5, 4.0);
                    arrowScale.Freeze();
                    CacheFreezable(arrowScale, (int)AeroFreezables.ArrowFillScale);
                }

                dc.PushTransform(arrowScale);

                dc.DrawGeometry(arrowFill, null, arrowGeometry);

                dc.Pop(); // Scale Transform
                dc.Pop(); // Position Transform
            }

            if (horizontal)
            {
                dc.Pop(); // Horizontal Rotate
            }
        }
Ejemplo n.º 2
0
        private void RenderTheme(DrawingContext dc)
        {
            Size renderSize = base.RenderSize;
            bool flag       = Orientation == Orientation.Horizontal;
            bool flag2      = IsClickable && base.IsEnabled;
            bool flag3      = flag2 && IsHovered;
            bool flag4      = flag2 && IsPressed;
            ListSortDirection?sortDirection = SortDirection;
            bool hasValue   = sortDirection.HasValue;
            bool isSelected = IsSelected;
            bool flag5      = !flag3 && !flag4 && !hasValue && !isSelected;

            EnsureCache(19);
            if (flag)
            {
                Matrix trans = default(Matrix);
                trans.RotateAt(-90.0, 0.0, 0.0);
                Matrix trans2 = default(Matrix);
                trans2.Translate(0.0, renderSize.Height);
                MatrixTransform matrixTransform = new MatrixTransform(trans * trans2);
                matrixTransform.Freeze();
                dc.PushTransform(matrixTransform);
                double width = renderSize.Width;
                renderSize.Width  = renderSize.Height;
                renderSize.Height = width;
            }
            if (flag5)
            {
                LinearGradientBrush linearGradientBrush = (LinearGradientBrush)GetCachedFreezable(0);
                if (linearGradientBrush == null)
                {
                    linearGradientBrush            = new LinearGradientBrush();
                    linearGradientBrush.StartPoint = default(Point);
                    linearGradientBrush.EndPoint   = new Point(0.0, 1.0);
                    linearGradientBrush.GradientStops.Add(new GradientStop(Color.FromArgb(byte.MaxValue, byte.MaxValue, byte.MaxValue, byte.MaxValue), 0.0));
                    linearGradientBrush.GradientStops.Add(new GradientStop(Color.FromArgb(byte.MaxValue, byte.MaxValue, byte.MaxValue, byte.MaxValue), 0.4));
                    linearGradientBrush.GradientStops.Add(new GradientStop(Color.FromArgb(byte.MaxValue, 252, 252, 253), 0.4));
                    linearGradientBrush.GradientStops.Add(new GradientStop(Color.FromArgb(byte.MaxValue, 251, 252, 252), 1.0));
                    linearGradientBrush.Freeze();
                    CacheFreezable(linearGradientBrush, 0);
                }
                dc.DrawRectangle(linearGradientBrush, null, new Rect(0.0, 0.0, renderSize.Width, renderSize.Height));
            }
            AeroFreezables aeroFreezables = AeroFreezables.NormalBackground;

            if (flag4)
            {
                aeroFreezables = AeroFreezables.PressedBackground;
            }
            else if (flag3)
            {
                aeroFreezables = AeroFreezables.HoveredBackground;
            }
            else if (hasValue | isSelected)
            {
                aeroFreezables = AeroFreezables.SortedBackground;
            }
            LinearGradientBrush linearGradientBrush2 = (LinearGradientBrush)GetCachedFreezable((int)aeroFreezables);

            if (linearGradientBrush2 == null)
            {
                linearGradientBrush2            = new LinearGradientBrush();
                linearGradientBrush2.StartPoint = default(Point);
                linearGradientBrush2.EndPoint   = new Point(0.0, 1.0);
                switch (aeroFreezables)
                {
                case AeroFreezables.NormalBackground:
                    linearGradientBrush2.GradientStops.Add(new GradientStop(Color.FromArgb(byte.MaxValue, byte.MaxValue, byte.MaxValue, byte.MaxValue), 0.0));
                    linearGradientBrush2.GradientStops.Add(new GradientStop(Color.FromArgb(byte.MaxValue, byte.MaxValue, byte.MaxValue, byte.MaxValue), 0.4));
                    linearGradientBrush2.GradientStops.Add(new GradientStop(Color.FromArgb(byte.MaxValue, 247, 248, 250), 0.4));
                    linearGradientBrush2.GradientStops.Add(new GradientStop(Color.FromArgb(byte.MaxValue, 241, 242, 244), 1.0));
                    break;

                case AeroFreezables.PressedBackground:
                    linearGradientBrush2.GradientStops.Add(new GradientStop(Color.FromArgb(byte.MaxValue, 188, 228, 249), 0.0));
                    linearGradientBrush2.GradientStops.Add(new GradientStop(Color.FromArgb(byte.MaxValue, 188, 228, 249), 0.4));
                    linearGradientBrush2.GradientStops.Add(new GradientStop(Color.FromArgb(byte.MaxValue, 141, 214, 247), 0.4));
                    linearGradientBrush2.GradientStops.Add(new GradientStop(Color.FromArgb(byte.MaxValue, 138, 209, 245), 1.0));
                    break;

                case AeroFreezables.HoveredBackground:
                    linearGradientBrush2.GradientStops.Add(new GradientStop(Color.FromArgb(byte.MaxValue, 227, 247, byte.MaxValue), 0.0));
                    linearGradientBrush2.GradientStops.Add(new GradientStop(Color.FromArgb(byte.MaxValue, 227, 247, byte.MaxValue), 0.4));
                    linearGradientBrush2.GradientStops.Add(new GradientStop(Color.FromArgb(byte.MaxValue, 189, 237, byte.MaxValue), 0.4));
                    linearGradientBrush2.GradientStops.Add(new GradientStop(Color.FromArgb(byte.MaxValue, 183, 231, 251), 1.0));
                    break;

                case AeroFreezables.SortedBackground:
                    linearGradientBrush2.GradientStops.Add(new GradientStop(Color.FromArgb(byte.MaxValue, 242, 249, 252), 0.0));
                    linearGradientBrush2.GradientStops.Add(new GradientStop(Color.FromArgb(byte.MaxValue, 242, 249, 252), 0.4));
                    linearGradientBrush2.GradientStops.Add(new GradientStop(Color.FromArgb(byte.MaxValue, 225, 241, 249), 0.4));
                    linearGradientBrush2.GradientStops.Add(new GradientStop(Color.FromArgb(byte.MaxValue, 216, 236, 246), 1.0));
                    break;
                }
                linearGradientBrush2.Freeze();
                CacheFreezable(linearGradientBrush2, (int)aeroFreezables);
            }
            dc.DrawRectangle(linearGradientBrush2, null, new Rect(0.0, 0.0, renderSize.Width, renderSize.Height));
            if (renderSize.Width >= 2.0)
            {
                AeroFreezables aeroFreezables2 = AeroFreezables.NormalSides;
                if (flag4)
                {
                    aeroFreezables2 = AeroFreezables.PressedSides;
                }
                else if (flag3)
                {
                    aeroFreezables2 = AeroFreezables.HoveredSides;
                }
                else if (hasValue | isSelected)
                {
                    aeroFreezables2 = AeroFreezables.SortedSides;
                }
                if (SeparatorVisibility == Visibility.Visible)
                {
                    Brush brush;
                    if (SeparatorBrush != null)
                    {
                        brush = SeparatorBrush;
                    }
                    else
                    {
                        brush = (Brush)GetCachedFreezable((int)aeroFreezables2);
                        if (brush == null)
                        {
                            LinearGradientBrush linearGradientBrush3 = null;
                            if (aeroFreezables2 != AeroFreezables.SortedSides)
                            {
                                linearGradientBrush3            = new LinearGradientBrush();
                                linearGradientBrush3.StartPoint = default(Point);
                                linearGradientBrush3.EndPoint   = new Point(0.0, 1.0);
                                brush = linearGradientBrush3;
                            }
                            switch (aeroFreezables2)
                            {
                            case AeroFreezables.NormalSides:
                                linearGradientBrush3.GradientStops.Add(new GradientStop(Color.FromArgb(byte.MaxValue, 242, 242, 242), 0.0));
                                linearGradientBrush3.GradientStops.Add(new GradientStop(Color.FromArgb(byte.MaxValue, 239, 239, 239), 0.4));
                                linearGradientBrush3.GradientStops.Add(new GradientStop(Color.FromArgb(byte.MaxValue, 231, 232, 234), 0.4));
                                linearGradientBrush3.GradientStops.Add(new GradientStop(Color.FromArgb(byte.MaxValue, 222, 223, 225), 1.0));
                                break;

                            case AeroFreezables.PressedSides:
                                linearGradientBrush3.GradientStops.Add(new GradientStop(Color.FromArgb(byte.MaxValue, 122, 158, 177), 0.0));
                                linearGradientBrush3.GradientStops.Add(new GradientStop(Color.FromArgb(byte.MaxValue, 122, 158, 177), 0.4));
                                linearGradientBrush3.GradientStops.Add(new GradientStop(Color.FromArgb(byte.MaxValue, 80, 145, 175), 0.4));
                                linearGradientBrush3.GradientStops.Add(new GradientStop(Color.FromArgb(byte.MaxValue, 77, 141, 173), 1.0));
                                break;

                            case AeroFreezables.HoveredSides:
                                linearGradientBrush3.GradientStops.Add(new GradientStop(Color.FromArgb(byte.MaxValue, 136, 203, 235), 0.0));
                                linearGradientBrush3.GradientStops.Add(new GradientStop(Color.FromArgb(byte.MaxValue, 136, 203, 235), 0.4));
                                linearGradientBrush3.GradientStops.Add(new GradientStop(Color.FromArgb(byte.MaxValue, 105, 187, 227), 0.4));
                                linearGradientBrush3.GradientStops.Add(new GradientStop(Color.FromArgb(byte.MaxValue, 105, 187, 227), 1.0));
                                break;

                            case AeroFreezables.SortedSides:
                                brush = new SolidColorBrush(Color.FromArgb(byte.MaxValue, 150, 217, 249));
                                break;
                            }
                            brush.Freeze();
                            CacheFreezable(brush, (int)aeroFreezables2);
                        }
                    }
                    dc.DrawRectangle(brush, null, new Rect(0.0, 0.0, 1.0, Max0(renderSize.Height - 0.95)));
                    dc.DrawRectangle(brush, null, new Rect(renderSize.Width - 1.0, 0.0, 1.0, Max0(renderSize.Height - 0.95)));
                }
            }
            if (flag4 && renderSize.Width >= 4.0 && renderSize.Height >= 4.0)
            {
                LinearGradientBrush linearGradientBrush4 = (LinearGradientBrush)GetCachedFreezable(5);
                if (linearGradientBrush4 == null)
                {
                    linearGradientBrush4            = new LinearGradientBrush();
                    linearGradientBrush4.StartPoint = default(Point);
                    linearGradientBrush4.EndPoint   = new Point(0.0, 1.0);
                    linearGradientBrush4.GradientStops.Add(new GradientStop(Color.FromArgb(byte.MaxValue, 134, 163, 178), 0.0));
                    linearGradientBrush4.GradientStops.Add(new GradientStop(Color.FromArgb(byte.MaxValue, 134, 163, 178), 0.1));
                    linearGradientBrush4.GradientStops.Add(new GradientStop(Color.FromArgb(byte.MaxValue, 170, 206, 225), 0.9));
                    linearGradientBrush4.GradientStops.Add(new GradientStop(Color.FromArgb(byte.MaxValue, 170, 206, 225), 1.0));
                    linearGradientBrush4.Freeze();
                    CacheFreezable(linearGradientBrush4, 5);
                }
                dc.DrawRectangle(linearGradientBrush4, null, new Rect(0.0, 0.0, renderSize.Width, 2.0));
                LinearGradientBrush linearGradientBrush5 = (LinearGradientBrush)GetCachedFreezable(10);
                if (linearGradientBrush5 == null)
                {
                    linearGradientBrush5            = new LinearGradientBrush();
                    linearGradientBrush5.StartPoint = default(Point);
                    linearGradientBrush5.EndPoint   = new Point(0.0, 1.0);
                    linearGradientBrush5.GradientStops.Add(new GradientStop(Color.FromArgb(byte.MaxValue, 162, 203, 224), 0.0));
                    linearGradientBrush5.GradientStops.Add(new GradientStop(Color.FromArgb(byte.MaxValue, 162, 203, 224), 0.4));
                    linearGradientBrush5.GradientStops.Add(new GradientStop(Color.FromArgb(byte.MaxValue, 114, 188, 223), 0.4));
                    linearGradientBrush5.GradientStops.Add(new GradientStop(Color.FromArgb(byte.MaxValue, 110, 184, 220), 1.0));
                    linearGradientBrush5.Freeze();
                    CacheFreezable(linearGradientBrush5, 10);
                }
                dc.DrawRectangle(linearGradientBrush5, null, new Rect(1.0, 0.0, 1.0, renderSize.Height - 0.95));
                dc.DrawRectangle(linearGradientBrush5, null, new Rect(renderSize.Width - 2.0, 0.0, 1.0, renderSize.Height - 0.95));
            }
            if (renderSize.Height >= 2.0)
            {
                AeroFreezables aeroFreezables3 = AeroFreezables.NormalBottom;
                if (flag4)
                {
                    aeroFreezables3 = AeroFreezables.PressedOrHoveredBottom;
                }
                else if (flag3)
                {
                    aeroFreezables3 = AeroFreezables.PressedOrHoveredBottom;
                }
                else if (hasValue | isSelected)
                {
                    aeroFreezables3 = AeroFreezables.SortedBottom;
                }
                SolidColorBrush solidColorBrush = (SolidColorBrush)GetCachedFreezable((int)aeroFreezables3);
                if (solidColorBrush == null)
                {
                    switch (aeroFreezables3)
                    {
                    case AeroFreezables.NormalBottom:
                        solidColorBrush = new SolidColorBrush(Color.FromArgb(byte.MaxValue, 213, 213, 213));
                        break;

                    case AeroFreezables.PressedOrHoveredBottom:
                        solidColorBrush = new SolidColorBrush(Color.FromArgb(byte.MaxValue, 147, 201, 227));
                        break;

                    case AeroFreezables.SortedBottom:
                        solidColorBrush = new SolidColorBrush(Color.FromArgb(byte.MaxValue, 150, 217, 249));
                        break;
                    }
                    solidColorBrush.Freeze();
                    CacheFreezable(solidColorBrush, (int)aeroFreezables3);
                }
                dc.DrawRectangle(solidColorBrush, null, new Rect(0.0, renderSize.Height - 1.0, renderSize.Width, 1.0));
            }
            if (hasValue && renderSize.Width > 14.0 && renderSize.Height > 10.0)
            {
                TranslateTransform translateTransform = new TranslateTransform((renderSize.Width - 8.0) * 0.5, 1.0);
                translateTransform.Freeze();
                dc.PushTransform(translateTransform);
                bool         flag6        = sortDirection == ListSortDirection.Ascending;
                PathGeometry pathGeometry = (PathGeometry)GetCachedFreezable(flag6 ? 17 : 18);
                if (pathGeometry == null)
                {
                    pathGeometry = new PathGeometry();
                    PathFigure pathFigure = new PathFigure();
                    if (flag6)
                    {
                        pathFigure.StartPoint = new Point(0.0, 4.0);
                        LineSegment lineSegment = new LineSegment(new Point(4.0, 0.0), false);
                        lineSegment.Freeze();
                        pathFigure.Segments.Add(lineSegment);
                        lineSegment = new LineSegment(new Point(8.0, 4.0), false);
                        lineSegment.Freeze();
                        pathFigure.Segments.Add(lineSegment);
                    }
                    else
                    {
                        pathFigure.StartPoint = new Point(0.0, 0.0);
                        LineSegment lineSegment2 = new LineSegment(new Point(8.0, 0.0), false);
                        lineSegment2.Freeze();
                        pathFigure.Segments.Add(lineSegment2);
                        lineSegment2 = new LineSegment(new Point(4.0, 4.0), false);
                        lineSegment2.Freeze();
                        pathFigure.Segments.Add(lineSegment2);
                    }
                    pathFigure.IsClosed = true;
                    pathFigure.Freeze();
                    pathGeometry.Figures.Add(pathFigure);
                    pathGeometry.Freeze();
                    CacheFreezable(pathGeometry, flag6 ? 17 : 18);
                }
                LinearGradientBrush linearGradientBrush6 = (LinearGradientBrush)GetCachedFreezable(14);
                if (linearGradientBrush6 == null)
                {
                    linearGradientBrush6            = new LinearGradientBrush();
                    linearGradientBrush6.StartPoint = default(Point);
                    linearGradientBrush6.EndPoint   = new Point(1.0, 1.0);
                    linearGradientBrush6.GradientStops.Add(new GradientStop(Color.FromArgb(byte.MaxValue, 60, 94, 114), 0.0));
                    linearGradientBrush6.GradientStops.Add(new GradientStop(Color.FromArgb(byte.MaxValue, 60, 94, 114), 0.1));
                    linearGradientBrush6.GradientStops.Add(new GradientStop(Color.FromArgb(byte.MaxValue, 195, 228, 245), 1.0));
                    linearGradientBrush6.Freeze();
                    CacheFreezable(linearGradientBrush6, 14);
                }
                dc.DrawGeometry(linearGradientBrush6, null, pathGeometry);
                LinearGradientBrush linearGradientBrush7 = (LinearGradientBrush)GetCachedFreezable(15);
                if (linearGradientBrush7 == null)
                {
                    linearGradientBrush7            = new LinearGradientBrush();
                    linearGradientBrush7.StartPoint = default(Point);
                    linearGradientBrush7.EndPoint   = new Point(1.0, 1.0);
                    linearGradientBrush7.GradientStops.Add(new GradientStop(Color.FromArgb(byte.MaxValue, 97, 150, 182), 0.0));
                    linearGradientBrush7.GradientStops.Add(new GradientStop(Color.FromArgb(byte.MaxValue, 97, 150, 182), 0.1));
                    linearGradientBrush7.GradientStops.Add(new GradientStop(Color.FromArgb(byte.MaxValue, 202, 230, 245), 1.0));
                    linearGradientBrush7.Freeze();
                    CacheFreezable(linearGradientBrush7, 15);
                }
                ScaleTransform scaleTransform = (ScaleTransform)GetCachedFreezable(16);
                if (scaleTransform == null)
                {
                    scaleTransform = new ScaleTransform(0.75, 0.75, 3.5, 4.0);
                    scaleTransform.Freeze();
                    CacheFreezable(scaleTransform, 16);
                }
                dc.PushTransform(scaleTransform);
                dc.DrawGeometry(linearGradientBrush7, null, pathGeometry);
                dc.Pop();
                dc.Pop();
            }
            if (flag)
            {
                dc.Pop();
            }
        }