Yeah, I had this problem a while ago, I resorted to a workaround, I will post here just incase its useful
<ScrollViewer HorizontalScrollBarVisibility="Auto">
<Grid x:Name="grid" MinWidth="200">
<DataGrid Width="{Binding ElementName=grid, Path=ActualWidth}">
<DataGrid.Columns>
<DataGridCheckBoxColumn Header="Column A" Width="1*"/>
<DataGridCheckBoxColumn Header="Column B" Width="1*"/>
</DataGrid.Columns>
</DataGrid>
</Grid>
</ScrollViewer>
The trick was to give the DataGrid
a width, in this case I bound back to the containing element
Or if you don't use the HorizontalScrollBar
you can disable it, this will allow the ScrollViewer
to calculate a width allowing the DataGrid to calculate a width.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…