Home Forums WinForms controls Xceed Grid for WinForms Xceed Grid for .Net – child rows border aren’t displayed corectly. Reply To: Xceed Grid for .Net – child rows border aren’t displayed corectly.

User (Old forums)
Member
Post count: 23064

Thanks for your reply Andre!

   I’ve made the changes that you suggest but the problem persists: the row right corner upper border of the childRows doesn’t appear. If i remove the myDetail.TopMargin.Height = 0;myDetail.BottomMargin.Height = 0 (for both detailGrid) from my code then all it’s ok. But i need those settings.

   I’ve simplified the example so now each detailsGrid and the main grid contains 2 columns: Name and Value. Another question that i have is:

    – How can i make that the value column to be allways (for the main grid and also for both detailsGrid) right aligned with the parent row Value Column. (i’m setting the width of each child Value column to the same value with it’s parent Value column width but for each child level it gets “delayed” with the length of the TreeViewLine between the parent and the child row). How can I know this TreeViewLine width? (so i can campute the width of the Name column to be smaller with this size).

 

<code>

 private void Form1_Load(object sender, EventArgs e)
        {
            this.gridControl1.BeginInit();

            this.groupByRow1.Visible = false;
            gridControl1.SynchronizeDetailGrids = false;

            // Add first GridTemplate.
            DetailGrid myDetail = new DetailGrid();
            myDetail.TopMargin.Height = 0;
            myDetail.BottomMargin.Height = 0;
            gridControl1.DetailGridTemplates.Add(myDetail);
            gridControl1.InitializingDetailGrid += new InitializingDetailGridEventHandler(gridControl1_InitializingDetailGrid);

            // Add second GridTemplate.
            DetailGrid myDetail2 = new DetailGrid();
            myDetail2.TopMargin.Height = 0;
            myDetail2.BottomMargin.Height = 0;
            gridControl1.DetailGridTemplates[0].DetailGridTemplates.Add(myDetail2);
            gridControl1.DetailGridTemplates[0].InitializingDetailGrid += new InitializingDetailGridEventHandler(Grid_InitializingDetailGrid);

            gridControl1.UpdateDetailGrids();
            gridControl1.EndInit();

            // Add columns.
            Column colName = new Column(“Name”);
            colName.Width = 200;
            gridControl1.Columns.Add(colName);

            Column colValue = new Column(“Value”);
            colValue.Width = 200;
            gridControl1.Columns.Add(colValue);

            // Add rows.
            for (int i = 0; i < 3; i++)
            {
                Xceed.Grid.DataRow row = gridControl1.DataRows.AddNew();
                row.Cells[“Name”].Value = “ParentName” + i.ToString();
                row.Cells[“Value”].Value = “ParentValue” + i.ToString();
                row.EndEdit();
            }
        }

        void gridControl1_InitializingDetailGrid(object sender, InitializingDetailGridEventArgs e)
        {
            Column colChildName = new Column(“ChildName”);
            colChildName.Width = 200;
            e.Grid.Columns.Add(colChildName);

            Column colChildValue = new Column(“ChildValue”);
            colChildValue.Width = 200;
            e.Grid.Columns.Add(colChildValue);

            for (int i = 0; i < 3; i++)
            {
                Xceed.Grid.DataRow row = e.Grid.DataRows.AddNew();
                row.Cells[“ChildName”].Value = “ChildName” + i.ToString();
                row.Cells[“ChildValue”].Value = “ChildValue” + i.ToString();
                row.EndEdit();
            }
        }

        void Grid_InitializingDetailGrid(object sender, InitializingDetailGridEventArgs e)
        {
            Column colChildName2nd = new Column(“ChildName2nd”);
            colChildName2nd.Width = 200;
            e.Grid.Columns.Add(colChildName2nd);

            Column colChildValue2nd = new Column(“ChildValue2nd”);
            colChildValue2nd.Width = 200;
            e.Grid.Columns.Add(colChildValue2nd);

            for (int i = 0; i < 3; i++)
            {
                Xceed.Grid.DataRow row = e.Grid.DataRows.AddNew();
                row.Cells[“ChildName2nd”].Value = “ChildName2nd ” + i.ToString();
                row.Cells[“ChildValue2nd”].Value = “ChildValue2nd” + i.ToString();
                row.EndEdit();
            }
        }

</code>

 

Best regards!

Imported from legacy forums. Posted by Mihai (had 443 views)