700字范文,内容丰富有趣,生活中的好帮手!
700字范文 > 自定义的 ListBoxItem 自适应ListBox的宽度

自定义的 ListBoxItem 自适应ListBox的宽度

时间:2023-09-16 21:28:08

相关推荐

自定义的 ListBoxItem 自适应ListBox的宽度

主要是要设置HorizontalContentAlignment的值,而不是HorizontalAlignment

<ListBox x:Name="xxx"><ListBox.ItemContainerStyle><Style TargetType="ListBoxItem"><Setter Property="HorizontalContentAlignment" Value="Stretch"/></Style></ListBox.ItemContainerStyle><ListBox.ItemTemplate><DataTemplate><StackPanel><Grid><TextBlock Text="www.tech-" HorizontalAlignment="Left"/><TextBlock Text="维思实验室" HorizontalAlignment="Right"/></Grid></StackPanel></DataTemplate></ListBox.ItemTemplate></ListBox>

@thl 2月14日 13:55:24

本内容不代表本网观点和政治立场,如有侵犯你的权益请联系我们处理。
网友评论
网友评论仅供其表达个人看法,并不表明网站立场。