WPF GridViewColumn Width=“auto” only works for items in the current scroll scope

南笙酒味 提交于 2019-12-01 05:49:47

The reason is that virtualization prevents some items from being generated, and then they are not considered for the calculation of the width.

So you can switch off the virtualization for the ListView with adding this to it ->

<ListView x:Name="lv" ScrollViewer.CanContentScroll="False">

But be careful it can slow down your app, if you have a lot of items, as they all will be generated at startup.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!