メッセージを表示する WPF リストボックスがあります。左側にアバターがあり、ユーザー名とメッセージがアバターの右側に垂直に積み上げられています。メッセージ テキストが折り返されるまでレイアウトは問題ありませんが、代わりにリスト ボックスに水平スクロール バーが表示されます。
私はグーグルで同様の問題の解決策を見つけましたが、どれもうまくいきませんでした。
<ListBox HorizontalContentAlignment="Stretch" ItemsSource="{Binding Path=FriendsTimeline}">
<ListBox.ItemTemplate>
<DataTemplate>
<StackPanel Orientation="Horizontal">
<Border BorderBrush="DarkBlue" BorderThickness="3" CornerRadius="2" Margin="3" >
<Image Height="32" Width="32" Source="{Binding Path=User.ProfileImageUrl}"/>
</Border>
<StackPanel Orientation="Vertical">
<TextBlock Text="{Binding Path=User.UserName}"/>
<TextBlock Text="{Binding Path=Text}" TextWrapping="WrapWithOverflow"/> <!-- This is the textblock I'm having issues with. -->
</StackPanel>
</StackPanel>
</DataTemplate>
</ListBox.ItemTemplate>
</ListBox>