Esempio n. 1
0
        private TableCellBorders GetCellBorders(Thickness?borderThickness, Brush borderBrush, TableCellBorders cellBorders,
                                                int rowIndex, int rowStartIndex, int rowEndIndex, int columnIndex, int columnStartIndex, int columnEndIndex, bool hasBackground)
        {
            Color borderBrushColor;

            GetColor(borderBrush, out borderBrushColor);

            if (!borderThickness.HasValue)
            {
                return(new TableCellBorders(new Telerik.Windows.Documents.Model.Border(BorderStyle.None)));
            }

            var thickness = borderThickness.Value;

            Telerik.Windows.Documents.Model.Border topBorder    = cellBorders.Top;
            Telerik.Windows.Documents.Model.Border bottomBorder = cellBorders.Bottom;
            Telerik.Windows.Documents.Model.Border leftBorder   = cellBorders.Left;
            Telerik.Windows.Documents.Model.Border rightBorder  = cellBorders.Right;

            if (rowIndex == rowStartIndex)
            {
                topBorder = new Telerik.Windows.Documents.Model.Border((float)thickness.Top, BorderStyle.Single, borderBrushColor);
            }

            if (rowIndex == rowEndIndex)
            {
                bottomBorder = new Telerik.Windows.Documents.Model.Border((float)thickness.Bottom, BorderStyle.Single, borderBrushColor);
            }

            if (rowStartIndex < rowIndex && rowIndex < rowEndIndex)
            {
                topBorder    = hasBackground ? new Telerik.Windows.Documents.Model.Border(BorderStyle.None) : cellBorders.Top;
                bottomBorder = hasBackground ? new Telerik.Windows.Documents.Model.Border(BorderStyle.None) : cellBorders.Bottom;
            }

            if (columnIndex == columnStartIndex)
            {
                leftBorder = new Telerik.Windows.Documents.Model.Border((float)thickness.Left, BorderStyle.Single, borderBrushColor);
            }

            if (columnIndex == columnEndIndex)
            {
                rightBorder = new Telerik.Windows.Documents.Model.Border((float)thickness.Right, BorderStyle.Single, borderBrushColor);
            }

            if (columnStartIndex < columnIndex && columnIndex < columnEndIndex)
            {
                leftBorder  = hasBackground ? new Telerik.Windows.Documents.Model.Border(BorderStyle.None) : cellBorders.Left;
                rightBorder = hasBackground ? new Telerik.Windows.Documents.Model.Border(BorderStyle.None) : cellBorders.Right;
            }

            return(new TableCellBorders(leftBorder, topBorder, rightBorder, bottomBorder));
        }
Esempio n. 2
0
        private TableCellBorders GetCellBorders(Thickness?borderThickness, Brush borderBrush, Position position, TableCellBorders cellBorders, bool isRow, bool hasBackground)
        {
            Color borderBrushColor;

            GetColor(borderBrush, out borderBrushColor);

            if (!borderThickness.HasValue)
            {
                return(new TableCellBorders(new Telerik.Windows.Documents.Model.Border(BorderStyle.None)));
            }

            var thickness = borderThickness.Value;

            if (isRow)
            {
                var leftBorder  = new Telerik.Windows.Documents.Model.Border((float)thickness.Left, BorderStyle.Single, borderBrushColor);
                var rightBorder = new Telerik.Windows.Documents.Model.Border((float)thickness.Right, BorderStyle.Single, borderBrushColor);
                Telerik.Windows.Documents.Model.Border topBorder;
                Telerik.Windows.Documents.Model.Border bottomBorder;
                switch (position)
                {
                case Position.First:
                    topBorder    = new Telerik.Windows.Documents.Model.Border((float)thickness.Top, BorderStyle.Single, borderBrushColor);
                    bottomBorder = hasBackground ? new Telerik.Windows.Documents.Model.Border(BorderStyle.None) : cellBorders.Bottom;
                    break;

                case Position.Middle:
                    topBorder    = hasBackground ? new Telerik.Windows.Documents.Model.Border(BorderStyle.None) : cellBorders.Top;
                    bottomBorder = hasBackground ? new Telerik.Windows.Documents.Model.Border(BorderStyle.None) : cellBorders.Bottom;
                    break;

                case Position.Last:
                default:
                    topBorder    = hasBackground ? new Telerik.Windows.Documents.Model.Border(BorderStyle.None) : cellBorders.Top;
                    bottomBorder = new Telerik.Windows.Documents.Model.Border((float)thickness.Bottom, BorderStyle.Single, borderBrushColor);
                    break;
                }

                return(new TableCellBorders(leftBorder, topBorder, rightBorder, bottomBorder));
            }
            else
            {
                var topBorder    = new Telerik.Windows.Documents.Model.Border((float)thickness.Top, BorderStyle.Single, borderBrushColor);
                var bottomBorder = new Telerik.Windows.Documents.Model.Border((float)thickness.Bottom, BorderStyle.Single, borderBrushColor);
                Telerik.Windows.Documents.Model.Border leftBorder;
                Telerik.Windows.Documents.Model.Border rightBorder;
                switch (position)
                {
                case Position.First:
                    leftBorder  = new Telerik.Windows.Documents.Model.Border((float)thickness.Left, BorderStyle.Single, borderBrushColor);
                    rightBorder = hasBackground ? new Telerik.Windows.Documents.Model.Border(BorderStyle.None) : cellBorders.Right;
                    break;

                case Position.Middle:
                    leftBorder  = hasBackground ? new Telerik.Windows.Documents.Model.Border(BorderStyle.None) : cellBorders.Left;
                    rightBorder = hasBackground ? new Telerik.Windows.Documents.Model.Border(BorderStyle.None) : cellBorders.Right;
                    break;

                case Position.Last:
                default:
                    leftBorder  = hasBackground ? new Telerik.Windows.Documents.Model.Border(BorderStyle.None) : cellBorders.Left;;
                    rightBorder = new Telerik.Windows.Documents.Model.Border((float)thickness.Right, BorderStyle.Single, borderBrushColor);
                    break;
                }

                return(new TableCellBorders(leftBorder, topBorder, rightBorder, bottomBorder));
            }
        }
Esempio n. 3
0
        private TableCellBorders GetCellBorders(Thickness? borderThickness, Brush borderBrush, Position position, TableCellBorders cellBorders, bool isRow, bool hasBackground)
        {
            Color borderBrushColor;
            GetColor(borderBrush, out borderBrushColor);

            if (!borderThickness.HasValue)
            {
                return new TableCellBorders(new Telerik.Windows.Documents.Model.Border(BorderStyle.None));
            }

            var thickness = borderThickness.Value;
            if (isRow)
            {
                var leftBorder = new Telerik.Windows.Documents.Model.Border((float)thickness.Left, BorderStyle.Single, borderBrushColor);
                var rightBorder = new Telerik.Windows.Documents.Model.Border((float)thickness.Right, BorderStyle.Single, borderBrushColor);
                Telerik.Windows.Documents.Model.Border topBorder;
                Telerik.Windows.Documents.Model.Border bottomBorder;
                switch (position)
                {
                    case Position.First:
                        topBorder = new Telerik.Windows.Documents.Model.Border((float)thickness.Top, BorderStyle.Single, borderBrushColor);
                        bottomBorder = hasBackground ? new Telerik.Windows.Documents.Model.Border(BorderStyle.None) : cellBorders.Bottom;
                        break;

                    case Position.Middle:
                        topBorder = hasBackground ? new Telerik.Windows.Documents.Model.Border(BorderStyle.None) : cellBorders.Top;
                        bottomBorder = hasBackground ? new Telerik.Windows.Documents.Model.Border(BorderStyle.None) : cellBorders.Bottom;
                        break;

                    case Position.Last:
                    default:
                        topBorder = hasBackground ? new Telerik.Windows.Documents.Model.Border(BorderStyle.None) : cellBorders.Top;
                        bottomBorder = new Telerik.Windows.Documents.Model.Border((float)thickness.Bottom, BorderStyle.Single, borderBrushColor);
                        break;
                }

                return new TableCellBorders(leftBorder, topBorder, rightBorder, bottomBorder);
            }
            else
            {
                var topBorder = new Telerik.Windows.Documents.Model.Border((float)thickness.Top, BorderStyle.Single, borderBrushColor);
                var bottomBorder = new Telerik.Windows.Documents.Model.Border((float)thickness.Bottom, BorderStyle.Single, borderBrushColor);
                Telerik.Windows.Documents.Model.Border leftBorder;
                Telerik.Windows.Documents.Model.Border rightBorder;
                switch (position)
                {
                    case Position.First:
                        leftBorder = new Telerik.Windows.Documents.Model.Border((float)thickness.Left, BorderStyle.Single, borderBrushColor);
                        rightBorder = hasBackground ? new Telerik.Windows.Documents.Model.Border(BorderStyle.None) : cellBorders.Right;
                        break;

                    case Position.Middle:
                        leftBorder = hasBackground ? new Telerik.Windows.Documents.Model.Border(BorderStyle.None) : cellBorders.Left;
                        rightBorder = hasBackground ? new Telerik.Windows.Documents.Model.Border(BorderStyle.None) : cellBorders.Right;
                        break;

                    case Position.Last:
                    default:
                        leftBorder = hasBackground ? new Telerik.Windows.Documents.Model.Border(BorderStyle.None) : cellBorders.Left; ;
                        rightBorder = new Telerik.Windows.Documents.Model.Border((float)thickness.Right, BorderStyle.Single, borderBrushColor);
                        break;
                }

                return new TableCellBorders(leftBorder, topBorder, rightBorder, bottomBorder);
            }
        }
Esempio n. 4
0
        private TableCellBorders GetCellBorders(Thickness? borderThickness, Brush borderBrush, TableCellBorders cellBorders,
            int rowIndex, int rowStartIndex, int rowEndIndex, int columnIndex, int columnStartIndex, int columnEndIndex, bool hasBackground)
        {
            Color borderBrushColor;
            GetColor(borderBrush, out borderBrushColor);

            if (!borderThickness.HasValue)
            {
                return new TableCellBorders(new Telerik.Windows.Documents.Model.Border(BorderStyle.None));
            }

            var thickness = borderThickness.Value;
            Telerik.Windows.Documents.Model.Border topBorder = cellBorders.Top;
            Telerik.Windows.Documents.Model.Border bottomBorder = cellBorders.Bottom;
            Telerik.Windows.Documents.Model.Border leftBorder = cellBorders.Left;
            Telerik.Windows.Documents.Model.Border rightBorder = cellBorders.Right;

            if (rowIndex == rowStartIndex)
            {
                topBorder = new Telerik.Windows.Documents.Model.Border((float)thickness.Top, BorderStyle.Single, borderBrushColor);
            }

            if (rowIndex == rowEndIndex)
            {
                bottomBorder = new Telerik.Windows.Documents.Model.Border((float)thickness.Bottom, BorderStyle.Single, borderBrushColor);
            }

            if (rowStartIndex < rowIndex && rowIndex < rowEndIndex)
            {
                topBorder = hasBackground ? new Telerik.Windows.Documents.Model.Border(BorderStyle.None) : cellBorders.Top;
                bottomBorder = hasBackground ? new Telerik.Windows.Documents.Model.Border(BorderStyle.None) : cellBorders.Bottom;
            }

            if (columnIndex == columnStartIndex)
            {
                leftBorder = new Telerik.Windows.Documents.Model.Border((float)thickness.Left, BorderStyle.Single, borderBrushColor);
            }

            if (columnIndex == columnEndIndex)
            {
                rightBorder = new Telerik.Windows.Documents.Model.Border((float)thickness.Right, BorderStyle.Single, borderBrushColor);
            }

            if (columnStartIndex < columnIndex && columnIndex < columnEndIndex)
            {
                leftBorder = hasBackground ? new Telerik.Windows.Documents.Model.Border(BorderStyle.None) : cellBorders.Left;
                rightBorder = hasBackground ? new Telerik.Windows.Documents.Model.Border(BorderStyle.None) : cellBorders.Right;
            }

            return new TableCellBorders(leftBorder, topBorder, rightBorder, bottomBorder);
        }