1

I would like to bind a listview's column headers with the data being returned by my ItemsSource. I have a listview layed out the following way:

<ListView DataContext="{Binding ElementName=This}" ItemsSource="{Binding}">
    <ListView.View>
         <GridView>
             <GridViewColumn DisplayMemberBinding="{Binding ColumnValue1" />
             <GridViewColumn DisplayMemberBinding="{Binding ColumnValue2">
                  <GridViewColumnHeader Content="{Binding ShortDescription}" />
             </GridViewColumn>
         </GridView>
     </ListView.View>
<ListView>

I have a List that I am setting to the Listview's ItemsSource in the code behind. The listview's row data are being populated correctly. However, the column header is not being set to the value in the List.

I have tried by following a previous question, but that didn't seem to work.

I know I am doing something wrong, just not sure what.

Community
  • 1
  • 1
Matthew
  • 145
  • 1
  • 2
  • 9
  • If you want to change the Header shouldn't you target the `Header` property on `GridViewColumn`? – Kevin DiTraglia Jan 15 '14 at 23:18
  • I've tried binding the value to the header property in the GridViewColumn, but that didn't work either. In the 2nd GridvViewColumn you can see the GridViewColumnHeader which allows you to set more properties on the Header – Matthew Jan 16 '14 at 12:21

0 Answers0