I have a DataGrid embedded inside the first column of a Grid. I want the grid column to auto size to content, but when I do this and the DataGrid gets too wide (when columns are added by the user) the DataGrid is clipped by the containing column. Essentially I need to retain the scrolling behaviour of the DataGrid, but have the DataGrid shrink to content and never be clipped.
<UserControl
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:data="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.Data">
<Border x:Name="LayoutRoot" Background="White">
<Grid HorizontalAlignment="Stretch">
<Grid.RowDefinitions>
<RowDefinition
Height="Auto" />
<RowDefinition
Height="Auto" />
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition
Width="Auto" />
</Grid.ColumnDefinitions>
<Border><!--Toolbar content goes here--></Border>
<data:DataGrid
MaxHeight="350"
Grid.Row="1" />
</Grid>
</Border>