简体   繁体   中英

WinForms ListViewGroup in WPF

Check this:

ListViewGroup

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

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 .

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.

WPF中的分组通常使用集合视图示例 )来完成,这些组在项目控件中的表示方式取决于GroupStyle ,可以将GroupStyle调整为所需的外观。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM