Hi
I have an ultragrid with a parent band having cardview children.
What I would like to do is hide a cardview column if there is no data for that column, while keeping the column for other parent records if the column does have data. (I've attached a picture as it doesn't look like my pasted picture - which might be below - will show)
In initializeRow, for any row in band 2 I tried the following, but it hides the Cost for all child records, not just the cost for the second parent. Is what I'm wanting to do possible?
private void ultraGrid1_InitializeRow(object sender, Infragistics.Win.UltraWinGrid.InitializeRowEventArgs e)
{
if(e.Row.Band.Index == 1)
ParentObject parentObject = e.Row.ParentRow.ListObject as ParentObject;
bool showCostColumn = false;
foreach(ChildObject childObject in parentObject.LineItems)
if (childObject.Cost.HasValue)
showCostColumn = true;
}
e.Row.Cells["Cost"].Column.Hidden = !showCostColumn;
Thanks for any advice that you can offer.
Steve
Hello Steve,
Thank you for your feedback.
In order to achieve the result you need you may refactor your data. You can add one child band for the items which contains cost and second child band for the items without cost. Please find attached a small sample solution implementing this approach.
Please let me know if you need any further assistance.
Thanks for the amazingly swift reply Mike.
Unfortunately that solution is not going to work for me as I would still like to use merged labels for the cards.
Its not a big issue leaving it as it is though.
cheers
Hi Steve,
The column object applies to the entire band across all islands. So you cannot hide a column under one parent without hiding it under all of them. There's no way to do that.
However, if you just want to hide empty cells in your card, you could set the band.CardSettings.Style to VariableHeight.