Exemplo n.º 1
0
            public Row(ResizableGrid owner, int rowIndex)
                : base(owner)
            {
                RowCellList = new List <RowCell>();
                foreach (ContentPresenter cp in Owner.Children)
                {
                    GridColumnData gridColumnData = (GridColumnData)cp.Content;
                    ColumnBase     gridColumn     = gridColumnData.Column;

                    int row     = BandedViewBehavior.GetRow(gridColumn);
                    int rowSpan = BandedViewBehavior.GetRowSpan(gridColumn);
                    if (row <= rowIndex && row + rowSpan > rowIndex)
                    {
                        RowCellList.Add(new RowCell(Owner, gridColumn, cp));
                    }

                    Comparison <RowCell> sortingMethos = (rowCell1, rowCell2) => {
                        if (rowCell1.Column == rowCell2.Column)
                        {
                            return(0);
                        }
                        return(rowCell1.Column < rowCell2.Column ? -1 : 1);
                    };
                    RowCellList.Sort(sortingMethos);
                }
            }
Exemplo n.º 2
0
        void PrepareChild(ContentPresenter child, ColumnBase column)
        {
            int columnCorrectingCoef     = BandedViewBehavior.GetIsLeftColumn(column) ? 0 : 1;
            int columnSpanCorrectingCoef = BandedViewBehavior.GetIsLeftColumn(column) ? 1 : 0;

            StdGrid.SetRow(child, BandedViewBehavior.GetRow(column));
            StdGrid.SetColumn(child, BandedViewBehavior.GetColumn(column) + columnCorrectingCoef);
            StdGrid.SetRowSpan(child, BandedViewBehavior.GetRowSpan(column));
            StdGrid.SetColumnSpan(child, BandedViewBehavior.GetColumnSpan(column) + columnSpanCorrectingCoef);
        }
Exemplo n.º 3
0
 public RowCell(ResizableGrid owner, ColumnBase gridColumn, ContentPresenter contentPresenter)
     : base(owner)
 {
     GridColumnPresenter = contentPresenter;
     GridColumn          = gridColumn;
     Row               = BandedViewBehavior.GetRow(GridColumn);
     RowSpan           = BandedViewBehavior.GetRowSpan(GridColumn);
     Column            = BandedViewBehavior.GetColumn(GridColumn);
     ColumnSpan        = BandedViewBehavior.GetColumnSpan(GridColumn);
     ColumnDefinitions = new ColumnDefinitions();
     for (int i = Column; i < Column + ColumnSpan; i++)
     {
         ColumnDefinitions.Add(Owner.BandBehavior.ColumnDefinitions[i]);
     }
 }
        protected override FrameworkElement CreateChild(object item)
        {
            GridCellData cellData   = (GridCellData)item;
            ColumnBase   gridColumn = cellData.Column;
            AutoWidthCellContentPresenter presenter = new AutoWidthCellContentPresenter();
            int row        = BandedViewBehavior.GetRow(gridColumn);
            int column     = BandedViewBehavior.GetColumn(gridColumn) + 1;
            int rowSpan    = BandedViewBehavior.GetRowSpan(gridColumn);
            int columnSpan = BandedViewBehavior.GetColumnSpan(gridColumn);

            StdGrid.SetRow(presenter, row);
            StdGrid.SetColumn(presenter, column);
            StdGrid.SetRowSpan(presenter, rowSpan);
            StdGrid.SetColumnSpan(presenter, columnSpan);
            if (BandedViewBehavior.GetIsBand(gridColumn))
            {
                presenter.Visibility = Visibility.Collapsed;
            }
            else
            {
                presenter.Visibility = Visibility.Visible;
            }
            return(presenter);
        }