WPF - 为什么列表框项目不填充uniformgrid [英] WPF - Why Listbox items do not fill uniformgrid

查看:22
本文介绍了WPF - 为什么列表框项目不填充uniformgrid的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个列表框,其中 ItemsPanelTemplate 设置为 UniformGrid,rows= 6 和 cols= 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.

我的模板的外部控件是一个 Border,Horizo​​ntalAlignment=Stretch和 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

推荐答案

在 LISTBOX 而不是数据模板上设置 Horizo​​ntalContentAligment 和 VerticalContentAlignment 为 Stretch 的答案.

The answer to this to set HorizontalContentAligment and VerticalContentAlignment to Stretch on the LISTBOX not the datatemplate.

这篇关于WPF - 为什么列表框项目不填充uniformgrid的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆