This project is read-only.

insert row in grid with Linked Controls

Nov 16, 2010 at 11:38 AM

i have a grid with a linked control in each cell.

when i try to insert a row in the grid, the new row apears, but linked controls stay where they were (they do not move with their cells)

screenshots: http://dl.dropbox.com/u/4810401/add_row.PNG

manually changing Position of linked control does not help too.

 

how can i achieve that linked controls move down with their corresponding cells when inserting a row?

thank You.

 

here is the code i use for inserting the row:

private void button1_Click(object sender, EventArgs e)
        {
            this.grid.Rows.Insert(3);
            for (int i = 0; i < 3; i++)
            {
                this.grid[3, i+1] = new SourceGrid.Cells.Cell();
            }

            foreach (SourceGrid.LinkedControlValue lcv in this.grid.LinkedControls)
            {
                if (lcv.Position.Row >= 3)
                {
                    lcv.Position = new SourceGrid.Position(lcv.Position.Row + 1, lcv.Position.Column);
                }
            }
        }

Nov 17, 2010 at 1:43 PM

Found solution myslef. The method ArrangeLinkedControls() does exactly what is needed.