Hello,
I have a grid with just a single header row and want to have a common column header for two colums but the problem is that the columns get merged respectively the second column overlays the first one. I modified your sample of common headers to demonstrate the issue.
<igDP:XamDataGrid DataSource="{Binding Source={StaticResource provider}}" x:Name="xdg">
<igDP:XamDataGrid.FieldLayoutSettings>
<igDP:FieldLayoutSettings AutoGenerateFields="False" AutoArrangeCells="Never" />
igDP:XamDataGrid.FieldLayoutSettings>
<igDP:XamDataGrid.FieldLayouts>
<igDP:FieldLayout>
<igDP:Field Name="FirstName" Label="Name" Row="0" Column="0" ColumnSpan="2"/>
<igDP:Field Name="LastName" Label="Last Name" Row="0" Column="1" />
<igDP:Field Name="Email" Row="0" Column="2" />
<igDP:Field Name="Age" Row="0" Column="3" />
<igDP:Field Name="BirthDay" Row="0" Column="4" />
<igDP:Field Name="Gender" Row="0" Column="5" />
<igDP:Field Name="Interests" />
igDP:FieldLayout>
igDP:XamDataGrid.FieldLayouts>
igDP:XamDataGrid>
What do I have to do to keep the two columns separated under the common header?
Regards
Thank you for your post. I have been looking into it, but it seems like that I am missing something in your scenario, so if this is still an issue for you, could you please send an isolated sample project, where the issue is reproduced and screenshots of the desired result, so I can investigate it further for you.
Looking forward for your reply.
see attached an isolated project and screenshots. Hope know it's clear?!
Current:
Expected:
I have been looking into the screenshots and I can suggest you use the following definition of the XamDataGrid’s FieldLayout instead of yours:
<igDP:XamDataGrid DataSource="{Binding Source={StaticResource provider}}" x:Name="xdg"> <igDP:XamDataGrid.FieldLayoutSettings> <igDP:FieldLayoutSettings AutoGenerateFields="True" AutoArrangeCells="Never" /> </igDP:XamDataGrid.FieldLayoutSettings> <igDP:XamDataGrid.FieldLayouts> <igDP:FieldLayout> <igDP:Field Name="FirstName" Row="0" Column="0"> <igDP:Field.Settings> <igDP:FieldSettings LabelHeight="0"/> </igDP:Field.Settings> </igDP:Field> <igDP:Field Name="LastName" Row="0" Column="1" > <igDP:Field.Settings> <igDP:FieldSettings LabelHeight="0"/> </igDP:Field.Settings> </igDP:Field> <igDP:UnboundField Label="Name" Row="0" Column="0" ColumnSpan="2"> <igDP:UnboundField.Settings> <igDP:FieldSettings CellMaxHeight="0" /> </igDP:UnboundField.Settings> </igDP:UnboundField> <igDP:Field Name="Email" Row="0" Column="2" /> <igDP:Field Name="Age" Row="0" Column="3" /> <igDP:Field Name="BirthDay" Row="0" Column="4" /> <igDP:Field Name="Gender" Row="0" Column="5" /> <igDP:Field Name="Interests" /> </igDP:FieldLayout> </igDP:XamDataGrid.FieldLayouts> </igDP:XamDataGrid>
Please let me know if this helps you or you need further assistance on this matter.
This does the trick! Thanks for your help!
But why are you setting the CellMaxHeight of the unbound field to zero, is this neccessary?
Thank you for your feedback. I am glad that you resolved your issue and I believe that other community members may benefit from this as well. You should set the UnboundField's CellMaxHeight, because otherwise there will be Cells created for the UnboundField, which is not necessary.