Let's say I have the following xaml:
<Grid MaxHeight="200" d:LayoutOverrides="Width">
<Grid.ColumnDefinitions>
<ColumnDefinition />
<ColumnDefinition Width="Auto"/>
</Grid.ColumnDefinitions>
<ListBox Height="170" ScrollViewer.HorizontalScrollBarVisibility="Visible" ItemsSource="{Binding DataModel.LocalData.ListFabricRules}" IsEnabled="{Binding DataModel.LocalData.Enabled}" SelectedItem="{Binding DataModel.LocalData.ListFabricRulesSelected}" >
<ListBox.ItemTemplate>
<DataTemplate>
<Grid>
<TextBlock Text="{Binding Descript}" />
</Grid>
</DataTemplate>
</ListBox.ItemTemplate>
</ListBox>
<StackPanel Grid.Column="1" Orientation="Vertical" d:LayoutOverrides="Height" Margin="10,0" IsEnabled="{Binding DataModel.LocalData.EnabledRules}">
<Button Content="Test" />
</StackPanel>
</Grid>
The goal of layout is that the listbox fill the free space (in column), and in the right of listbox there is a button. The issue is the following: When the listbox show the horizontal scroll (because the contain text is large), their width increment change grid proportions, so the button move to right, without respect margins and occupying more than main grid. When put the main grid inside of a Scrollviewer, the scroll is partially hidden. The host of main grid is usercontrol.