benrhughes/todotxt.net — pull request #138 by kevininspace (2013-01-11 05:16:46+00:00)
Title: Added option to allow for grouping, including in print view.

Hi Ben.

I've been working on this for a while and finally got it working. When my todo.txt file gets unruly, I like to see things with similar contexts close together. So I found a way to group them visually, removing the group descriptions only if the sort is alphabetical or file order. For contexts, priority, projects, etc... I add a "HeaderTitle" which gets displayed both on screen and in print/print preview. To avoid an empty section, I'm forced to add a "No Context"/"No Project"/"N/A" header title when the task has no context, etc...

Also, if a task has many contexts, (e.g. Call Mom @home @phone) it will appear in both groupings, which I think is pretty cool.

![todogrouping](https://f.cloud.github.com/assets/62999/59229/02277b78-5bad-11e2-8e2a-d13f933230fa.png)

(I'm terribly sorry for the excessive indenting and spacing changes. I run ReSharper to clean up my code after debugging and it sometimes will re-indent the whole file.)

Next steps for me (some already in development):
-allow for a "clean-up" or resort of the file (change the order of the items in the file to keep similar contexts/projects closer together);
-implement intellisense in the filter, allow for correct sorting of group headers (e.g. @home before @phone before @work).
-There is also a much more elegant way to implement the grouping which is UI only (XAML only) but I have yet to get it fully functional. This would mean that the viewmodel would only have a nice, clean list of tasks and sorting and filtering and grouping would be UI-only operations which affect how the list is viewed, which I think is correct.