[WPF]ListBoxでアイテムの幅をリストボックスの幅に合わせる


DataTempleteを使用して作成したデータ構造を使うと、何故かアイテムの幅がリストボックスの幅よりも小さいと言う状態になります。
ListBoxのスタイルを以下のように設定を行うとListBoxの幅いっぱいにアイテムが表示されます。

<ListBox>
<ListBox.ItemContainerStyle>
<Style TargetType="ListBoxItem">
<Setter Property="HorizontalContentAlignment" Value="Stretch"></Setter>
</Style>
</ListBox.ItemContainerStyle>
</ListBox>


0 件のコメント :

コメントを投稿