示例#1
0
        /// <summary>
        /// Calculates the position style.
        /// </summary>
        /// <returns>The position style.</returns>
        /// <param name="cell">Cell.</param>
        private CellPositionType CalculatePosStyle(DSGridCellView cell)
        {
            //1) is top left
            if (cell.ColumnIndex == 0 && this.PositionType == RowPositionType.Top)
            {
                return(CellPositionType.LeftTop);
            }
            else if (cell.ColumnIndex == 0 && this.PositionType == RowPositionType.Bottom)
            {
                return(CellPositionType.LeftBottom);
            }
            else if (cell.ColumnIndex == 0)
            {
                return(CellPositionType.LeftMiddle);
            }
            else if (cell.ColumnIndex == Columns.Count - 1 && this.PositionType == RowPositionType.Top)
            {
                return(CellPositionType.RightTop);
            }
            else if (cell.ColumnIndex == Columns.Count - 1 && this.PositionType == RowPositionType.Bottom)
            {
                return(CellPositionType.RightBottom);
            }
            else if (cell.ColumnIndex == Columns.Count - 1)
            {
                return(CellPositionType.RightMiddle);
            }
            else if (this.PositionType == RowPositionType.Top)
            {
                return(CellPositionType.CenterTop);
            }
            else if (this.PositionType == RowPositionType.Bottom)
            {
                return(CellPositionType.CenterBottom);
            }
            else
            {
                return(CellPositionType.CenterMiddle);
            }

            //return CellPositionType.LeftTop;
        }
示例#2
0
        /// <summary>
        /// ReDraw the row view
        /// </summary>
        private void ReDraw()
        {
            foreach (var cel in Columns)
            {
                var cell = mCells [cel.xPosition];

                if (cell == null)
                {
                    cell = new DSGridCellView(this.mGridView, this);
                    mCells.Add(cell);
                }

                cell.Style = this.Style;

                if (RowIndex != 0)
                {
                    cell.IsOdd = (RowIndex % 2) != 0;
                }

                cell.ColumnIndex = cel.xPosition;
                cell.RowIndex    = this.RowIndex;

                var aRect = cel.Frame.ToRectangleF();
                aRect.Height    = this.Frame.Height;
                cell.Frame      = aRect.Integral();
                cell.IsSelected = IsSelected;
                cell.IsReadOnly = cel.IsReadOnly;

                //work out the position style
                cell.ColumnName   = cel.Name;
                cell.PositionType = CalculatePosStyle(cell);
                cell.Formatter    = cel.Formatter;
                cell.SortStyle    = cel.SortStyle;

                if (cell.Superview == null)
                {
                    this.AddSubview(cell, NSWindowOrderingMode.Below, this.Subviews[0]);
                }
                //this.InsertSubview (cell, 0);
            }
        }
示例#3
0
 /// <summary>
 /// Handles the cell double tapped.
 /// </summary>
 /// <param name="sender">Sender.</param>
 void HandleCellDoubleTapped(DSGridCellView sender)
 {
     mGridView.HandleOnSelectedRowChanged(RowIndex);
     mGridView.HandleOnCellDoubleTap(sender);
     mGridView.HandleOnRowDoubleSelect(this);
 }