Beispiel #1
0
        void CreateColumnHeaderArgs()
        {
            ColumnHeaderArgs.Clear();
            int x = HeaderArea.X;

            foreach (var column in VisibleColumns)
            {
                var header = new HeaderObjectInfoArgs {
                    Bounds  = new Rectangle(x, HeaderArea.Y, Math.Min(column.Width, HeaderArea.Width - x), HeaderArea.Height),
                    Caption = column.Caption,
                };
                if (ColumnHeaderArgs.Count == 0)
                {
                    header.HeaderPosition = HeaderPositionKind.Left;
                }
                header.SetAppearance(AppearanceColumnHeader);
                ColumnHeaderArgs.Add(header);
                x += column.Width;
                if (x > HeaderArea.Right)
                {
                    break;
                }
            }

            //Stretch the last header to fill the entire width
            var last = ColumnHeaderArgs.Last();

            last.Bounds         = new Rectangle(last.Bounds.X, last.Bounds.Y, HeaderArea.Right - last.Bounds.X, HeaderArea.Height);
            last.HeaderPosition = HeaderPositionKind.Right;

            foreach (var header in ColumnHeaderArgs)
            {
                HeaderPainter.CalcObjectBounds(header);
            }
        }
        public void Refresh()
        {
            var grid = (Grid)GetTemplateChild("PART_Content");
            var horizontalHierarchy = new DimensionHierarchyBuilder(Cube, HorizontalHierarchy).Build();
            var verticalHierarchy   = new DimensionHierarchyBuilder(Cube, VerticalHierarchy).Build();
            var spaceAllocator      = new GridSpaceAllocator(grid, horizontalHierarchy, verticalHierarchy);

            spaceAllocator.AllocateSpace();
            var itemFactory   = new ItemFactory();
            var headerPainter = new HeaderPainter(grid, itemFactory);

            headerPainter.Paint(horizontalHierarchy, spaceAllocator.HorizontalHierarchyPosition, GridOrientation.Horizontal);
            headerPainter.Paint(verticalHierarchy, spaceAllocator.VerticalHierarchyPosition, GridOrientation.Vertical);
            var factPainter = new FactPainter(grid, Cube, itemFactory);

            factPainter.Paint(horizontalHierarchy, verticalHierarchy, spaceAllocator.FactTablePosition);
        }