Skumar
Skumar

Reputation:

Wpf Expander inside the Listview

how to put an expander inside listivew?. I want to show expander as rows in listview.

Upvotes: 0

Views: 3505

Answers (2)

Jim
Jim

Reputation: 4950

You could do something like this where you define the ListView style to place an expander around the GridViewRowPresenter

<ListView.Resources>
<Style  TargetType="{x:Type ListViewItem}">
    <Setter Property="HorizontalContentAlignment" Value="Stretch" />
    <Setter Property="VerticalContentAlignment"   Value="Stretch" />
    <Setter Property="Template">
        <Setter.Value>
            <ControlTemplate TargetType="{x:Type ListViewItem}">
                <Expander Header="{Binding ColumnCaption}">
                    <GridViewRowPresenter VerticalAlignment="{TemplateBinding VerticalContentAlignment}" Grid.IsSharedSizeScope="True">
                    </GridViewRowPresenter>
                </Expander>
            </ControlTemplate>
        </Setter.Value>
    </Setter>
</Style>                        
</ListView.Resources>

Upvotes: 1

SLaks
SLaks

Reputation: 887275

You can put the expander in the ItemTemplate.

Upvotes: 0

Related Questions