Esempio n. 1
0
        /// <summary>
        /// Updates the selection
        /// </summary>
        /// <param name="index">Index.</param>
        public void UpdateSelection(int index)
        {
            var aRow = CurrentTable.GetRow(index);

            if (aRow != null)
            {
                UpdateSelection(aRow.RowId);
            }
        }
Esempio n. 2
0
        /// <summary>
        /// Finds the view for row.
        /// </summary>
        /// <returns>The view for row.</returns>
        /// <param name="Index">Index.</param>
        /// <param name="NewFunction">New function.</param>
        public IDSGridRowView FindViewForRow(int Index, Func <int, IDSGridRowView> NewFunction)
        {
            var aRow = Rows.ViewForRowIndex(Index);

            //see if a row is already available
            if (aRow == null)
            {
                //load one from the freecells collection
                if (FreeRows.Count != 0)
                {
                    aRow = FreeRows [0];

                    if (aRow != null)
                    {
                        aRow.Processor.RowIndex = Index;
                        FreeRows.RemoveAt(0);
                    }
                }

                if (aRow == null)
                {
                    aRow = NewFunction(Index);

                    //aRow = new DSGridRowView (Index, this);
                }

                //
                aRow.Processor.Style = CellStyle.Cell;

                //add to collection
                Rows.Add(aRow);
            }

            if (Index == 0)
            {
                aRow.Processor.Style = (this.ThemeHeaderStyle() == GridHeaderStyle.Fixed) ? CellStyle.Blank : CellStyle.Header;
            }

            //Work out the position of the row in the grid
            if (Index == 0)
            {
                aRow.Processor.PositionType = RowPositionType.Top;
            }
            else if (Index == NumberOfRows - 1)
            {
                aRow.Processor.PositionType = RowPositionType.Bottom;
            }
            else
            {
                aRow.Processor.PositionType = RowPositionType.Middle;
            }

            aRow.Processor.IsSelected = false;

            if (Index != 0)
            {
                var aDSRow = CurrentTable.GetRow(aRow.Processor.RowIndex);

                if (aDSRow != null)
                {
                    aRow.Processor.RowId      = aDSRow.RowId;
                    aRow.Processor.IsSelected = mSelectedRowGuids.Contains(aRow.Processor.RowId);
                }
            }



            return(aRow);
        }