WPF-为什么列表框项不能填充均匀网格 [英] WPF - Why Listbox items do not fill uniformgrid
问题描述
我有一个列表框,其中ItemsPanelTemplate设置为UniformGrid,行数= 6,列数= 7.
I have a listbox with the ItemsPanelTemplate set to UniformGrid with rows= 6 and cols= 7.
我希望列表框项目填充其空间.
I want the listbox items to fill their space.
我正在使用字典中定义的数据模板.
I am using a datatemplete defined in a dictionary.
我模板的外部控件是一个带有HorizontalAlignment = Stretch的Border 和VerticalAlignent = Strectch,但是模板没有填充列表框项目的空间吗?
The outer control of my template is a Border with HorizontalAlignment=Stretch and VerticalAlignent=Strectch but the templates do not fill the listbox items space?
有什么想法吗? 马尔科姆
Any ideas? Malcolm
推荐答案
对此的答案是将HorizontalContentAligment和VerticalContentAlignment设置为在LISTBOX而不是数据模板上拉伸.
The answer to this to set HorizontalContentAligment and VerticalContentAlignment to Stretch on the LISTBOX not the datatemplate.
这篇关于WPF-为什么列表框项不能填充均匀网格的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!