WPF ListView's GridView item expansion

Posted by NT_ on Stack Overflow See other posts from Stack Overflow or by NT_
Published on 2010-05-06T11:10:06Z Indexed on 2010/05/06 11:38 UTC
Read the original article Hit count: 485

Filed under:
|
|
|

Is it possible for a WPF ListView that uses a GridView view (ListView.View property) to have one of its items 'expanded' i.e. create some control underneath the item. I cannot simply add another item as it will assume the GridView item template, i.e. appear with columns rather than being a single usable area.

This is how my list view currently looks like, it just has two columns:

<ListView x:Name="SomeName" Style="{DynamicResource NormalListView}" >
    <ListView.View> 
        <GridView ColumnHeaderContainerStyle="{DynamicResource NormalListViewHeader}">
            <GridViewColumn Width="140" x:Name="Gvc_Name">
                <GridViewColumn.CellTemplate>
                    <DataTemplate>
                        <Border Style="{DynamicResource ListViewCellSeparatorBorder}" >
                            <StackPanel Orientation="Vertical" HorizontalAlignment="Stretch" VerticalAlignment="Stretch">
                                <TextBlock Text="{Binding Path=Name}" FontWeight="Bold" HorizontalAlignment="Left" />
                                <TextBlock Text="{Binding Path=Type}" HorizontalAlignment="Left" />
                            </StackPanel>
                        </Border>
                    </DataTemplate>
                </GridViewColumn.CellTemplate>
                <Border Style="{DynamicResource ListViewHeaderBorderContainer}">
                    <TextBlock Style="{DynamicResource ListViewHeaderText}" Text="Name"/>
                </Border>
            </GridViewColumn>
            <GridViewColumn Width="120" x:Name="Gvc_Timestamp">
                <GridViewColumn.CellTemplate>
                    <DataTemplate>
                        <Border Style="{DynamicResource ListViewCellSeparatorBorder}">
                            <StackPanel Orientation="Vertical" HorizontalAlignment="Stretch" VerticalAlignment="Stretch">
                                <TextBlock Text="{Binding Path=TimestampDate}" HorizontalAlignment="Center" />
                                <TextBlock Text="{Binding Path=TimestampTime}" FontWeight="Bold" HorizontalAlignment="Center" />
                            </StackPanel>
                        </Border>
                    </DataTemplate>
                </GridViewColumn.CellTemplate>
                <Border Style="{DynamicResource ListViewHeaderBorderContainer}">
                    <TextBlock Style="{DynamicResource ListViewHeaderText}" Text="Processed"/>
                </Border>
            </GridViewColumn>
        </GridView>
    </ListView.View>
</ListView>

Many thanks!

© Stack Overflow or respective owner

Related posts about wpf

Related posts about listview