Hello,
Can i add 2 footer caption to differentiate Average and summary? Check the below example
Charge Type
Charge 1
Charge 2
Charge 3
AAA
10
20
30
BBB
CCC
DDD
Average
Summary
40
80
120
if i can, can i get sample code for this?
Thanks,
Mayank
Hello Mayank,
Maybe you could try the code below:
ultraGrid1.DisplayLayout.Bands[0].Summaries.Add(Infragistics.Win.UltraWinGrid.SummaryType.Average, ultraGrid1.DisplayLayout.Bands[0].Columns["Charge 1"], Infragistics.Win.UltraWinGrid.SummaryPosition.UseSummaryPositionColumn);
ultraGrid1.DisplayLayout.Bands[0].Summaries.Add(Infragistics.Win.UltraWinGrid.SummaryType.Sum, ultraGrid1.DisplayLayout.Bands[0].Columns["Charge 1"], Infragistics.Win.UltraWinGrid.SummaryPosition.UseSummaryPositionColumn);
ultraGrid1.DisplayLayout.Bands[0].Summaries.Add(Infragistics.Win.UltraWinGrid.SummaryType.Average, ultraGrid1.DisplayLayout.Bands[0].Columns["Charge 2"], Infragistics.Win.UltraWinGrid.SummaryPosition.UseSummaryPositionColumn);
ultraGrid1.DisplayLayout.Bands[0].Summaries.Add(Infragistics.Win.UltraWinGrid.SummaryType.Sum, ultraGrid1.DisplayLayout.Bands[0].Columns["Charge 2"], Infragistics.Win.UltraWinGrid.SummaryPosition.UseSummaryPositionColumn);
ultraGrid1.DisplayLayout.Bands[0].Summaries.Add(Infragistics.Win.UltraWinGrid.SummaryType.Average, ultraGrid1.DisplayLayout.Bands[0].Columns["Charge 3"], Infragistics.Win.UltraWinGrid.SummaryPosition.UseSummaryPositionColumn);
ultraGrid1.DisplayLayout.Bands[0].Summaries.Add(Infragistics.Win.UltraWinGrid.SummaryType.Sum, ultraGrid1.DisplayLayout.Bands[0].Columns["Charge 3"], Infragistics.Win.UltraWinGrid.SummaryPosition.UseSummaryPositionColumn);
Please take a look on attached sample for more details and if you have any questions, feel free to write me
Regards
Sample :
Thanks Gerogi.
It works the way i wanted. :)
thanks for ur reply!!!
but unfortunately it doesn't work.
it does not move the focus from the last of the current group to the first row of the next group.
Hi,
I made small modifications in the code. Please try :
private void ultraGrid1_Paint(object sender, PaintEventArgs e)
{
SummaryValueUIElement a = ultraGrid1.DisplayLayout.UIElement.GetDescendant(typeof(SummaryValueUIElement), ultraGrid1.DisplayLayout.Bands[0].Summaries[1]) as SummaryValueUIElement;
if (a != null)
a.Rect = new Rectangle(a.Parent.Rect.X, a.Rect.Y,a.Rect.Width, a.Rect.Height);
ultraGrid1.Invalidate();
}
Also, please note that you should set :
ultraGrid1.DisplayLayout.Bands[0].Summaries[1].Appearance.TextHAlign = Infragistics.Win.HAlign.Left;
Let me know if you have any questions.
Hi, i m using ultragird and keydown event to move the focus to the next row of the same column.it works fine. but when i drag the column to the header of the group, it works for only one group. it doesn't move to the next group automatically.following is the code for moving focus to the same cell of the next row:private void dgvSaleCustomers_KeyDown(object sender, KeyEventArgs e){switch (e.KeyCode){case Keys.Down:case Keys.Enter:this.dgvSaleCustomers.PerformAction(UltraGridAction.ExitEditMode, false, false);UltraGridBand b = this.dgvSaleCustomers.DisplayLayout.Bands[0];if (dgvSaleCustomers.ActiveRow.HasNextSibling(true)){UltraGridRow nextRow = dgvSaleCustomers.ActiveRow.GetSibling(SiblingRow.Next, true);dgvSaleCustomers.ActiveCell = nextRow.Cells[dgvSaleCustomers.ActiveCell.Column];e.Handled = true;this.dgvSaleCustomers.PerformAction(UltraGridAction.EnterEditMode, false, false);}break;Please advice. waiting for your reply!!!!!!!!
The only problem with this when you move Charge 1 column it will move label(Display Format = "Summary") with the column. Average would stay there because it is a footer caption.