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,
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.
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); } }
}
Hi Rob,
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.
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.
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;