Elmo
Elmo

Reputation: 6471

WinForms ListViewGroup in WPF

Check this:

ListViewGroup

Can I add ListViewGroup in WPF? Or a equivalent to that?

Upvotes: 0

Views: 518

Answers (3)

brunnerh
brunnerh

Reputation: 184441

Grouping in WPF is usually done using collection views (example), how those groups are represented in an items control dependes on the GroupStyle which can be adjusted to look like what you want.

Upvotes: 2

Lukazoid
Lukazoid

Reputation: 19416

Grouping can be used in WPF, for example:

<GroupBox Header="Example">
    <GroupBox.Resources>
       <CollectionViewSource x:Key="GroupedSource" Source="{Binding Items}">
           <CollectionViewSource.GroupDescriptions>
               <PropertyGroupDescription PropertyName="PropertyToGroupOn" />
           </CollectionViewSource.GroupDescriptions>
        </CollectionViewSource>
    </GroupBox.Resources>

    <ListBox ItemsSource="{StaticResource GroupedItemsSource}" />
</GroupBox>

This will show a ListBox with its items grouped based on the property PropertyToGroupOn.

Upvotes: 3

Samuel Slade
Samuel Slade

Reputation: 8613

You can host WinForms control inside WPF controls using the WindowsFormsHost control. Alternately, a quick Google search revealed a CodeProject sample that may do what you want in WPF.

Upvotes: 2

Related Questions