WPF ListView column auto sizing

Posted by Diego Mijelshon on Stack Overflow See other posts from Stack Overflow or by Diego Mijelshon
Published on 2010-05-14T14:38:35Z Indexed on 2010/05/14 14:44 UTC
Read the original article Hit count: 733

Filed under:
|
|

Let's say I have the following ListView:

<ListView ScrollViewer.VerticalScrollBarVisibility="Auto">
  <ListView.View>
    <GridView>
      <GridViewColumn Header="Something" 
                      DisplayMemberBinding="{Binding Path=ShortText}" />
      <GridViewColumn Header="Description"
                      DisplayMemberBinding="{Binding Path=VeryLongTextWithCRs}" />
      <GridViewColumn Header="Something Else" 
                      DisplayMemberBinding="{Binding Path=AnotherShortText}" />
    </GridView>
  </ListView.View>
</ListView>

I'd like the short text columns to always fit in the screen, and the long text column to use the remaining space, word-wrapping if necessary.

Is that possible?

© Stack Overflow or respective owner

Related posts about wpf

Related posts about listview