I used TemplateColumnLayout to display row detail info, when detail info is empty, click the expand button, it will show an extremely large empty block(please refer the attachment), I already set RowHeight to Dynamic, but it doesn't work for this scenario. Is there a way to not show this empty block if detail info is empty, or at least make it smaller?
Hi Hu Lu,
The height for the TemplateColumnLayout is determined by the content inside the template. When using the TemplateColumnLayout, you have to specify a DataTemplate for the Template property. Can you provide me what you used for the DataTemplate?
Here is the definition of the DataTemplate, I also attach the project I used.
<ig:TemplateColumnLayout Key="SubTables" AutoGenerateColumns="False" RowHeight="Dynamic">
<ig:TemplateColumnLayout.Template>
<DataTemplate>
<StackPanel Orientation="Horizontal" >
<ig:XamGrid ItemsSource="{Binding EsvList}" AutoGenerateColumns="False">
<ig:XamGrid.Columns>
<ig:GroupColumn Key="Group">
<ig:GroupColumn.Columns>
<ig:TextColumn Key="Name" HeaderText="EsvName" FormatString="{}{0:0.###}" AllowToolTips="Overflow"/>
<ig:TextColumn Key="Volume" HeaderText="Volume" AllowToolTips="Overflow"/>
</ig:GroupColumn.Columns>
</ig:GroupColumn>
</ig:XamGrid.Columns>
</ig:XamGrid>
<ig:XamGrid BorderThickness="1" ItemsSource="{Binding BvalueList}" AutoGenerateColumns="False">
<ig:TextColumn Key="Name" AllowToolTips="Overflow" HeaderTextHorizontalAlignment="Center" HeaderText="BvalueName" />
<ig:TextColumn Key="Value" AllowToolTips="Overflow" HeaderTextHorizontalAlignment="Center" HeaderText="Bvalue" />
</StackPanel>
</DataTemplate>
</ig:TemplateColumnLayout.Template>
</ig:TemplateColumnLayout>
Thanks for the sample. From the code I can see that the space you see is being occupied by the XamGrid that is inside the TemplateColumnLayout. The XamGrid has some sort of height set to it due to the column headers it created but since it is inside a StackPanel it's width is being squished. Not really sure why though as the columns themselves should have some sort of width. I think the best way to handle this is to set the Visibility on the grids to collapsed if there is no data. A simple converter could do the trick.
I have updated your sample to demonstrate this. Let me know if you have any questions.
Thanks, it works.