How do I use a ItemTemplateSelector together with a HeaderTemplate in a WPF ListView?

前端 未结 1 1791
野的像风
野的像风 2021-01-12 00:06

Suppose the following XAML defined window:



        
相关标签:
1条回答
  • 2021-01-12 00:38

    I think what you are trying to do is style a single GridViewColumn and its Header. So move the TemplateSelector from the ListView to the GridViewColumn definition:

    <Grid>
      <ListView ItemsSource="{Binding Source={StaticResource XmlData}, XPath='/Items/Item'}">
      <ListView.View>
        <GridView>
          <GridViewColumn Width="Auto" CellTemplateSelector="{StaticResource TypeSelector}" HeaderTemplate="{StaticResource HeaderTemplate}"/>
        </GridView>
      </ListView.View>
      </ListView>
    </Grid>
    
    0 讨论(0)
提交回复
热议问题