I've got unusual problem that I can't solve. I want to use DataGrid with fixed column sizes that will size up to parent. Structure looks more less like this:
UserControl put on ScrollViewer sizes correctly to parent unless it reaches MinWidth then scrollbar appears. All controls on UserControl are stretched when someone resize window. Only individual is DataGrid. It doesn't want to enable horizontal scroll no matter how much I try it always makes UserControl scale to it's width. This of course enables scroll under UserControl which I want to prevent.
in short I want DataGrid to take up 100% of available width but not more.
<Window>
<ScrollViewer>
<UserControl>
<Grid>
<DataGrid>
</DataGrid>
</Grid>
</UserControl>
</ScrollViewer>
</Window>
I also tried to do something like that, but it failed :(
<Window>
<ScrollViewer>
<UserControl>
<Grid>
<ScrollViewer>
<DockPanel>
<DataGrid>
</DataGrid>
</DockPanel>
</ScrollViewer>
</Grid>
</UserControl>
</ScrollViewer>
</Window>
Also hooking up to SizeChanged and initially setting Width of DataGrid to some small fixed value event did not make the test. Probably because I'm operating on UserControl derived code.
I need suggestions.