且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

如何让 ListBox ItemTemplate 水平拉伸 ListBox 的整个宽度?

更新时间:2023-10-07 18:37:40

我确定这是一个重复的问题,但我找不到答案相同的问题.

I'm sure this is a duplicate, but I can't find a question with the same answer.

Horizo​​ntalContentAlignment="Stretch" 添加到您的列表框.这应该够了吧.请小心使用自动完成功能,因为很容易错误地获取 Horizo​​ntalAlignment.

Add HorizontalContentAlignment="Stretch" to your ListBox. That should do the trick. Just be careful with auto-complete because it is so easy to get HorizontalAlignment by mistake.