I have a XamTile with a grid. The grid has no width properties set. Inside the grid is a XamDataGrid with several columns. I have AutoFitMode="ExtendLastField" to extend the last column.
The problem is that when I resize the XamTile to a narrower width, the XamDataGrid does not resize along with the narrower width of the tile.
I have tried to set a style for the width, then either bind the XamDataGrid width to that style or apply the style to it
This is the style:
<Style x:Key="FlexibleWidth" TargetType="{x:Type igDP:XamDataGrid}"> <Setter Property="Width" Value="{Binding ElementName=UserGrid, Path=ActualWidth}" /> </Style>
This is the binding width attempt:
Width="{Binding ElementName=UserGrid, Path=ActualWidth}"
This is the applying a style to the XamDataGrid attempt:
Style="{StaticResource FlexibleWidth}
Is there a way to have the XamDataGrid resize to the width of the parent grid each time the XamTile is resized?
Hello,
I have been looking into the sample I can say that this behavior is expected since you set the Width of the Grid that contains the XamDataGrid. This way the XamDataGrid doesn’t change its width when you resize the window. If you remove the Width of the Grid everything works as you want.
What I have found out is that if the xamdatagrid is included with other items in a scrollviewer, then the scrollviewer prevents the child content from horizontally resizing properly, regardless of the AutoFit properties that have been set for the xamdatagrid.
I have included a sample project where you can comment /uncomment the scroll viewer to see how it behaves in each case when your resize the window horizontally.
I would like to hear your feedback and to see if you know of a work-around for this issue.
Thank you for your post. I have been looking into it and I can suggest you set the XamDataGrid’s AutoFit Property to True instead of the FieldLayoutSettings’ AutoFitMode to ExtendLastField in order to achieve the functionality you want. Please let me know if this helps you or you need further assistance on this matter.
Looking forward for your reply.