列表框DataTemplate不使用整个宽度 [英] Listbox DataTemplate not using the entire width

查看:67
本文介绍了列表框DataTemplate不使用整个宽度的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在桌面应用程序中使用带有定义的DataTemplate的列表框,但是当我调整此窗口的大小时,列表框不会调整大小,即我希望该列表框应占据所有可用空间.

列表框(或任何其他控件)应占据其容器的所有可用空间.例如:

 <  网格 > ; 
     <   ListBox     ="   0,0,0,0"   名称  ="    / >> 
<  /Grid  >  



希望这会有所帮助!


I am using a listbox with my defined DataTemplate in my desktop application but when I am resizing this window the listbox doesn''t resize i.e I want that this listbox should occupy all the available space.

解决方案

Listbox (or any other control) should occupy all available space of it''s container if you don''t define Height, Width, HorizontalAlignment and VerticalAligment. Here is example:

<Grid>
     <ListBox Margin="0,0,0,0" Name="listBox1" />
</Grid>



Hope this helps!


这篇关于列表框DataTemplate不使用整个宽度的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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