ListBox with HorizontalAlignment set to "Stretch" moves list content left when pressing buttons
Posted: 14 Mar 2017, 07:18
I have a TabControl with a Tabitem, as defined below:
When pressing the Button, the ListBox content shifts to the left. It also happens when the width of the ListBox is the same size as the container.
Code: Select all
<ListBox
x:Name="KeyBindingsList"
Height="Auto"
HorizontalAlignment="Stretch"
VerticalAlignment="Top"
ScrollViewer.HorizontalScrollBarVisibility="Disabled">
<ListBox.ItemTemplate>
<DataTemplate>
<UniformGrid Columns="2">
<Label Content="{Binding Path=Name}" VerticalAlignment="Center" />
<Button Content="{Binding Path=PrimaryKeyName}" />
</UniformGrid>
</DataTemplate>
</ListBox.ItemTemplate>
</ListBox>