0

How can i expand the first row of a ultrawingrid which has the child row on load ? here is the way i want ultrawingrid to look like

in this ultrawingrid there are multiple rows which has child rows but i want to expand only first row which has child row like shown in picture. using C# .Net

I know that using expanAll methos i can expand all the rows.

Also i know that ExpandAncestors() will expand the row which i want(provided i need to select a row as child)

How can i achive this ? Thanks in Advance...

4

1 回答 1

3

我不确定是否有更好的方法,但如您所知,UltraWinGrid 的不同级别称为 Bands,DisplayLayout 属性中提供了这些 Bands 的集合。

这个想法是枚举顶级带中的行,并在将 DataSource 设置为该带的第一行之后将 Expanded 属性设置为 true。

// Returns a DataSet with two tables linked with a DataRelation
DataSet ds = GetDataSource;
grdMyData.DataSource = ds; 

// Now loop on the rows of the first band
foreach (UltraGridRow row in grdMyData.DisplayLayout.Bands[0].GetRowEnumerator(GridRowType.DataRow))
{
    // If the row has child rows, then set the its Expanded property 
    // to true and exits immediately the loop
    if (row.HasChild())
    {
        row.Expanded = true;
        break;
    }
}
于 2013-07-25T07:59:25.023 回答