Sunday, November 6, 2011

XamDataGrid - Something like near Merge Cells

Merging Cells across rows with same column values

Windows version UltraGrid had simple way of doing this. But this does not exist in XamDataGrid. So the workarounds!!!  There could be other or better ways but I followed this way.

Took hierarchical data approach. Having a DataSet was not an option for me, hence sorted data into parent child lists like below. DataRecordsList was the DataSource for XamDataGrid

public List<HierarchicalNode<T>> DataRecordsList;

public class HierarchicalNode
{
           public List<T> TopNode {get; set;}
           public List<T> ChildNodes {get; set;}
}

UltraGrid had bands concept, but here we have them as FieldLayouts. Defined two field layouts for the parent and child.  Parent FieldLayout needed additional column for ChildNodes and hidden some columns in child FieldLayout which would have been the part of merged cells.

Well this approach needed some ugly settings like adjusting parent and column lengths, hiding child column headers, and structure of data is completely different than what i would have desired. Also the merged cell text is like fixed and cannot be aligned vertically. Would love UltraGrid more than XamDataGrid...

No comments:

Post a Comment