ListView control with controls for columns : ListView « Windows Presentation Foundation « VB.Net Tutorial






<Page xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
      xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
      HorizontalAlignment="Center" VerticalAlignment="Center">
    <Grid HorizontalAlignment="Center" VerticalAlignment="Center">
      <Grid.Resources>
        <XmlDataProvider x:Key="myXml" XPath="/Root">
          <x:XData>
            <Root xmlns="">
              <Item id="A" flag="True" value="A" />
              <Item id="B" flag="True" value="B" />
              <Item id="C" flag="False" value="C" />
              <Item id="D" flag="True" value="D" />
            </Root>
          </x:XData>
        </XmlDataProvider>
      </Grid.Resources>
      <ListView DataContext="{StaticResource myXml}" ItemsSource="{Binding XPath=Item}">
        <ListView.View>
          <GridView>
            <GridViewColumn Header="ID" DisplayMemberBinding="{Binding XPath=@id}" />
            <GridViewColumn Header="Enabled">
              <GridViewColumn.CellTemplate>
                <DataTemplate>
                  <CheckBox IsChecked="{Binding XPath=@flag}" />
                </DataTemplate>
              </GridViewColumn.CellTemplate>
            </GridViewColumn>
            <GridViewColumn Header="Value">
              <GridViewColumn.CellTemplate>
                <DataTemplate>
                  <TextBox Text="{Binding XPath=@value}" Width="70" />
                </DataTemplate>
              </GridViewColumn.CellTemplate>
            </GridViewColumn>
          </GridView>
        </ListView.View>
      </ListView>
    </Grid>
</Page>
WPF List View Control With Controls For Columns








16.32.ListView
16.32.1.ListView control with controls for columnsListView control with controls for columns
16.32.2.Set Binding ListView.ItemsSourceProperty to ListViewSet Binding ListView.ItemsSourceProperty to ListView
16.32.3.Create a ListView control that uses a GridView view mode to display a collection of DateTime objects.Create a ListView control that uses a GridView view mode to display a collection of DateTime objects.
16.32.4.Get Bounded item from ListViewGet Bounded item from ListView
16.32.5.Create Binding for ListView in codeCreate Binding for ListView in code
16.32.6.Create a ListView control that uses a GridView view mode to display the contents of an ObservableCollection<(Of <(T>)>).Create a ListView control that uses a GridView view mode to display the contents of an ObservableCollection<(Of <(T>)>).
16.32.7.Use three TextBlocks in one ListViewItemUse three TextBlocks in one ListViewItem
16.32.8.Create a ListView control that uses a GridView view mode to display dates.Create a ListView control that uses a GridView view mode to display dates.
16.32.9.ListView using GridView.HeaderTemplate and GridViewColumn.CellTemplate propertiesListView using GridView.HeaderTemplate and GridViewColumn.CellTemplate properties