Hello,
I'm trying to use header groups, because I have somewhat similar like discussed in this thread:
http://blogs.infragistics.com/forums/p/40913/228624.aspx#228624
I can not figure out how the headers are align and the header width can be set. In my Grid every column stands for a time period of 15 minutes. My first header group should span 1 day (24 * 4 columns). The second header group stands for 1 hour (4 columns). For every 4 columns I add a header group.
For every hour group I set the day-group as parent:
groupHour.RowLayoutGroupInfo.SpanX = 4;
groupHour.RowLayoutGroupInfo.ParentGroup = groupDay;
groupHour.Width = 4 * myWidth;
For the columns I set the current hour group as parent:
col.RowLayoutColumnInfo.SpanX = 1;
col.RowLayoutColumnInfo.ParentGroup = groupHour;
col.Width = myWidth;
After this, the hour groups have the same width as the columns instead of span over 4 columns. Why this? How are the Origin and Span properties to be set to achieve this?
Thanks for help.
Markus
My groups looks like this:
and here is the code:
band0.Groups.Clear(); band0.RowLayoutStyle = RowLayoutStyle.GroupLayout; // Group Organisation UltraGridGroup groupOrg = band0.Groups.Add( "GroupOrg" ); groupOrg.RowLayoutGroupInfo.OriginX = 0; groupOrg.RowLayoutGroupInfo.OriginY = 0; groupOrg.RowLayoutGroupInfo.SpanX = 1; groupOrg.RowLayoutGroupInfo.SpanY = 2; groupOrg.RowLayoutGroupInfo.LabelSpan = 2; // Column Organisation UltraGridColumn col = band0.Columns[keyCol_Organisation]; col.RowLayoutColumnInfo.OriginX = 0; col.RowLayoutColumnInfo.OriginY = 0; col.RowLayoutColumnInfo.SpanX = 1; col.RowLayoutColumnInfo.SpanY = 1; col.RowLayoutColumnInfo.ParentGroup = groupOrg; // Group Day 0 UltraGridGroup groupDay0 = band0.Groups.Add( "GroupDay0" ); groupDay0.Header.Caption = "Day 0"; groupDay0.RowLayoutGroupInfo.OriginX = 1; groupDay0.RowLayoutGroupInfo.OriginY = 0; groupDay0.RowLayoutGroupInfo.SpanX = 24*4; // 24 * 4 columns of 15 minutes groupDay0.RowLayoutGroupInfo.SpanY = 1; // Group Day 1 UltraGridGroup groupDay1 = band0.Groups.Add( "GroupDay1" ); groupDay1.Header.Caption = "Day 1"; groupDay1.RowLayoutGroupInfo.OriginX = 2; groupDay1.RowLayoutGroupInfo.OriginY = 0; groupDay1.RowLayoutGroupInfo.SpanX = 24 * 4; // 24 * 4 columns of 15 minutes groupDay1.RowLayoutGroupInfo.SpanY = 1; // Group Hour 0 (Subgroup of Group Day 0) UltraGridGroup groupHour0 = band0.Groups.Add( "GroupHour0" ); groupHour0.Header.Caption = "Hour 0"; groupHour0.RowLayoutGroupInfo.OriginX = 0; groupHour0.RowLayoutGroupInfo.OriginY = 0; groupHour0.RowLayoutGroupInfo.SpanX = 4; // 4 columns of minutes groupHour0.RowLayoutGroupInfo.SpanY = 1; groupHour0.RowLayoutGroupInfo.ParentGroup = groupDay0; // Group Hour 1 (Subgroup of Group Day 0) UltraGridGroup groupHour1 = band0.Groups.Add( "GroupHour1" ); groupHour1.Header.Caption = "Hour 1"; groupHour1.RowLayoutGroupInfo.OriginX = 1; groupHour1.RowLayoutGroupInfo.OriginY = 0; groupHour1.RowLayoutGroupInfo.SpanX = 4; // 4 columns of minutes groupHour1.RowLayoutGroupInfo.SpanY = 1; groupHour1.RowLayoutGroupInfo.ParentGroup = groupDay0; // Columns 0...3 (columns of Group Hour 0) for ( int i = 0; i <= 45; i = i + 15 ) { col = band0.Columns[i.ToString()]; col.Header.Caption = i.ToString(); col.RowLayoutColumnInfo.OriginX = i / 15; col.RowLayoutColumnInfo.OriginY = 0; col.RowLayoutColumnInfo.SpanX = 1; col.RowLayoutColumnInfo.SpanY = 1; col.RowLayoutColumnInfo.ParentGroup = groupHour0; } // Columns 4...7 (columns of Group Hour 1) for ( int i = 60; i <= 105; i = i + 15 ) { col = band0.Columns[i.ToString()]; col.Header.Caption = i.ToString(); col.RowLayoutColumnInfo.OriginX = (i -60) / 15; col.RowLayoutColumnInfo.OriginY = 0; col.RowLayoutColumnInfo.SpanX = 1; col.RowLayoutColumnInfo.SpanY = 1; col.RowLayoutColumnInfo.ParentGroup = groupHour1; } // all other columns not assigned yet
As you can see Day 0 and Hour 0 are not showed. Columns 15 - 45 are not visible. What I want is that Hour 0 and Hour 1 groups are under Day 0 and columns 0,15,30 and 45 are under Hour 0 etc.
What do I missing here?
Thanks for help. Markus
Last post seems to have no picture:
Hope you got it.
Thank you for your feedback and for sharing this with our community.
Please do not hesitate to ask if something comes up.
I have figured it out (I hope): The RowLayoutGroupInfo.OriginX property of the "hour group" is calculated over all of the columns:
>> groupHour.RowLayoutGroupInfo.OriginX = hourIndex * 4;
That seems to be working. Anyway it looks not straight forward solution using those headres just for spanning some headers over cells.
I have oner more problem, but will start a new post for that.