2012-09-17 2 views
1

런타임시 열 수를 설정하는 ultrawingrid가 있습니다. ultragrid는 dock.fill로 설정된 속성을 가지고 있습니다. 또한 rowlayout과 함께 cardview에 있습니다. 5 개 이상의 열이있는 경우 wingrid가 다음 행의 다음 5 열을 표시하도록하고 행의 끝까지 계속 가로 스크롤 막대를 표시 할 필요가 없으며 모든 필드가 표시되도록합니다.ultragrid : 특정 숫자 이상인 경우 다음 행의 일부 열을 표시합니다.

예 :

Now they are arranged as 
| Column1 | text | Column2 | text | Column3 | text | Column4 | text | Column5 | text | 
and a scrollbar appears if they move beyond the right boundary. 
Instead I want it to show only 3 columns in first row then the others in next row and so on. 
No scrollbars. 
I have only 1 card and only 1 row.code here 

답변

0

열 위치를 설정하는 클래스입니다. 그리드 이름은 filtergrid입니다. 다른 것들은 거의 설명이 가능합니다. 우리는 단지 그리드를 디자인으로 선언했습니다 (어떤 이유로 우리는 코드 내부에 그리드를 선언 할 때이 함수를 사용할 수 없었습니다). 다른 모든 설정은 코드에서 수행되었습니다.

const int NoOfCols = 7; 
private void SetDefaultColumnPositions(RowLayoutColumnInfosCollection colInfos) 
{ 
    int totalColWidth = 0; 
    int visibleColumnCount = 0; 
    foreach (RowLayoutColumnInfo rlColInfo in colInfos) 
    { 
     if (rlColInfo.Column.Hidden == false) 
     { 
      visibleColumnCount++; 
      totalColWidth += rlColInfo.Column.CellSizeResolved.Width; 
     } 
    } 
    int NO_OF_ROWS = Convert.ToInt32(System.Math.Ceiling(visibleColumnCount * 1.0/NoOfCols)); 
    int columnCount = 0; 
    _filterGrid.Height = 22 * (NO_OF_ROWS); 
    if (columnCount == colInfos.Count) 
    { 
     return; 
    } 
    for (int i = 0; i < NO_OF_ROWS; i++) 
    { 
     for (int j = 0; j < NoOfCols; j++) 
     { 
      if (columnCount >= colInfos.Count) 
      { 
       return; 
      } 
      while (colInfos[columnCount].Column.Hidden) 
      { 
       ++columnCount; 
       if (columnCount >= colInfos.Count) 
       { 
        return; 
       } 
      } 
      if (columnCount < colInfos.Count) 
      { 
       colInfos[columnCount].Initialize((j +2) * 2, i * 2); 
       ++columnCount; 
      } 
      if (columnCount >= colInfos.Count) 
      { 
       break; 
      } 
     } 
     if (columnCount >= colInfos.Count) 
     { 
      break; 
     } 
    } 
}