Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
615
Bind XamDataGrid Width to Container Width
posted

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?