Hi,
I am using XamDataGrid version 12.2.
The records in my grid support parent child relationship. On the top of the grid I have the headers for every column. the issue comes when I expand any record. On expanding the child row becomes visible but with the column headers.
PFA screenshot for more clarity.
Hello Neelesh,
Thank you for your post.
I have been looking into your question and what I can suggest is to take a look at the following forum thread where similar functionality was discussed yet:
http://es.infragistics.com/community/forums/t/86347.aspx
Please let me know if you require any further assistance on the matter.
I already have a master layout to which I have added dynamic columns.
Now on top of this when I add parent and child layout as you mentioned it's not working and the grid comes up empty.
Also I did this in the AssigningFieldLayoutToItem event.
if (args.ParentExpandableFieldRecord == null) { //do nothing } else { args.FieldLayout.Settings.LabelLocation = LabelLocation.Hidden;}
but doing this removes label from the top of the grid also.
Hi Rob,
Could you help me with line of code on how to assign two different FieldLayoutSettings to two different FieldLayouts. My limitation is that I have to create FieldLayout in code behind. Following are the FieldLayoutSettings that I need my layouts to have:
FieldLayoutSettings.AutoGenerateFields = false; FieldLayoutSettings.AllowAddNew = false; FieldLayoutSettings.AllowDelete = false; FieldLayoutSettings.ExpansionIndicatorDisplayMode = ExpansionIndicatorDisplayMode.CheckOnDisplay; FieldLayoutSettings.FixedFieldUIType = FixedFieldUIType.None; FieldLayoutSettings.SelectionTypeRecord = Infragistics.Windows.Controls.SelectionType.Default;
Hi Neelesh,
Here is a sample that demonstrates how to use the AssigningFieldLayoutToItem event to assign your FieldLayouts. I first create the FieldLayouts and add them to the XamDataGrid's FieldLayout collection. Then inside the AssigningFieldLayoutToItem event I determine if the item is a parent or child record and then assign the respective FieldLayout.
Thanks Rob for all the guidance so far. But there is one major issue which came out.
After hiding the child labellocation now if I resize the parent the child column doesn't resize, it stays in it's original position. PFA screenshot for the same.
Kindly let me know how to bring both parent and child in sync.
Solved!
In XAML
<Style TargetType="{x:Type dataPresenter:LabelPresenter}"> <EventSetter Event="SizeChanged" Handler="LabelPresenters_SizeChanged"></EventSetter> </Style>
In .CS
void LabelPresenters_SizeChanged(object sender, SizeChangedEventArgs e) { Infragistics.Windows.DataPresenter.LabelPresenter lp = sender as Infragistics.Windows.DataPresenter.LabelPresenter;
if (lp.Field.Index <curveGrid.FieldLayouts[0].Fields.Count) { if (curveGrid.FieldLayouts[0].Fields.Contains(lp.Field)) { Infragistics.Windows.DataPresenter.Field f = this.curveGrid.FieldLayouts[1].Fields[lp.Field.Index]; f.Width = new Infragistics.Windows.DataPresenter.FieldLength(lp.Field.CellWidthResolved); }
if (curveGrid.FieldLayouts[1].Fields.Contains(lp.Field)) { Infragistics.Windows.DataPresenter.Field f = this.curveGrid.FieldLayouts[0].Fields[lp.Field.Index]; f.Width = new Infragistics.Windows.DataPresenter.FieldLength(lp.Field.CellWidthResolved); } }
}
Hello,
Thank you for your feedback.
I am very glad that you have manage to resolve your issue. If you require any further assistance on the matter, please do not hesitate to let me know.