共用方式為


ListView with grouping (In GridView mode)

ListView inherits GroupStyle from ItemsControl, so we can easily achieve grouping for GridView. The only thing we should provide is a GroupStyle. Besides, in order to collapse and expande a group, an Expander is added in the GroupStyle.

The number on the group header indicates the count of items in that group.

Declaimer: This posting is provided "AS IS" with no warranties, and confers no rights.

GridViewWithGrouping.xaml

Comments

  • Anonymous
    March 15, 2006
    Well, Duh...

    No offence, but how about some data editing.

    For almost a year already I'm really enjoying the unlimited possibilities of data visualization in Avalon and absolutely no support for any kind of non-trivial (fill in the form) data editing.

    How about modifying your very first example by adding the ability to add/modify an entry without additional forms i.e. directly in the list?

    Styling of controls is pretty cool, but some of us concerned with the UI usability more than with cool effects. How about at least one tiny example of data entry with Accept/Reject, Undo/Redo, "Do you want to save your changes?" prompt, etc. in less than 2000 lines of code?

    Nothing personal, but should we really need to consider WPF for the next version of our business application or we are fine with Forms for the next 5 years? Are we getting anything except round buttons, fuzzy fonts and 3d windows?
  • Anonymous
    March 15, 2006
    Thanks Alex.

    As sorting and grouping are common scenarios of ListView and some customers asked for them, we post those samples. As for Editing, it is not ListView goal, but we will give a sample to help customer.

    However, those detailed features like data entry with Accept/Reject, Undo/Redo may not be considered in the sample, we will only give a general one and cusomter can add any feature if he likes.

    Of course, if you have any issue in addin your features to the sample, feel free to contact with us.  
  • Anonymous
    March 15, 2006
    There will a simple editable ListView sample posted in a few days.
  • Anonymous
    March 16, 2006
    Please do not spend your time just to please me. It was a rhetorical question.

    Consider: Colors, Fonts, Grouping, Paging, Documents, Typography, 3D charts, ... - what kind of application are we talking about? Report Generator? While reporting is a very respectful feature of any application, the more interactive experience with data entry is what our customers expect from us and that's what we expect you - WPF architects - to help us with.
  • Anonymous
    March 21, 2006
    Alex, Editing sample is posted!
  • Anonymous
    March 31, 2006
    Very nice, except I don't seem to get a vertical scroll bar - is that to be expected?

    Thanks, Alec
  • Anonymous
    March 31, 2006
    Alec, if you set the ListView.Height property as a value smaller than needed, a vertical scroll bar will appear automatically.
  • Anonymous
    April 02, 2006
    Many thanks. I was putting your code within a stack panel and expecting a scroll bar to appear. Changed it to a grid and it worked.
  • Anonymous
    March 06, 2007
    Hi I'm new to wpf..Is there a an example of a listview with paging capabilities ?
  • Anonymous
    March 06, 2007
    PingBack from http://www.xamlformorons.com/?p=22
  • Anonymous
    June 21, 2007
    Hello there,My application makes heavy use of the ListViews sorting, grouping and filtering functionallity. Now this works pretty fine for <100 items and then the ListView starts lagging to death. Even if the window containing the list is not displayed(Z-Ordered behind another window) or minimized to task bar it doesn't get better.Meanwhile I know this is about some virtualized stack panel thing but I need the functionality.Is there a trick to get the panel virtualize again after it's sorted/grouped so that at least the UI gets responsive again after the list has been sorted/grouped?Regards,ITD
  • Anonymous
    December 04, 2007
    Hi,I've been trying to figure out how to move the group header from the top of the group to the left hand side of the group.  I know how to change the content of the group, but how do I move/transform it from a row to a column?Thanks!William