ListView column auto sizing

前端 未结 8 1923
执念已碎
执念已碎 2020-12-18 23:28

Let\'s say I have the following ListView:


  
    
            


        
8条回答
  •  隐瞒了意图╮
    2020-12-18 23:47

    There is no easy way to do this with a GridListView since it doesn't support setting the width of a column to "*" (fill remaining space).

    Here is a discussion of how you could fake it by using an IValueConverter to set the width of the column to TotalListWidth - SumOfColumnWidths

    On the other hand, have you considered using a DataGrid instead? This will support the kind of layout you are looking for, though is a considerably heavier control. It is also only native in .NET 4 - though you can get an equivalent for 3.5 through the WPF Toolkit.

提交回复
热议问题