We’re now going to build on these foundations and explore more advanced topics, such as grouping and custom layouts.
This article is published from the DNC Magazine for . Download this magazine from here [Zip PDF] or Subscribe to this magazine for FREE and download all previous and current editions An obvious visual problem with our UI so far is the lack of sufficient spacing around and between items.
This layer of indirection provides a suitable place where grouping, sorting, and filtering of the underlying data can occur.
We’re not going to be discussing sorting and filtering in this article because they’re entirely data concerns, but let’s take a look at how we can group our data.
Otherwise, in the eyes of the user, it can be hard to tell where one item ends and the next begins.
Sufficient spacing is one way to achieve this, but when the volume of data is high and screen real estate is of high importance, an alternating background color from one item to the next is another common technique.
Of course, we could address this by adding margins to the , but that would result in duplicate code and would couple our templates more tightly to a specific context.
But this approach doesn’t help us in this scenario because we want to group by the type of place, and we have no appropriate property that gives us that information.The visual tree is created for each tab only when the tab becomes visible for the first time.If a tab never becomes visible, its content may never be created.We’ve just discussed how we can dynamically choose a style by using for even indices and another for odd indices.And what happens when we add or rearrange items in our list? The first thing you’ll notice is that I’ve added some more data to make our changes easier to spot. The derived classes all provide richer containers for their items, and those containers will generally facilitate background color changes.There may be slight differences in feature sets or usage here and there, but for the most part your knowledge will be transferrable.In the first part of this article we covered the fundamentals of the .But why is there nothing to visually demarcate each group?That’s because we haven’t supplied a property enables us to choose the layout panel that hosts the groups (we’ll be covering layout customization in a later section).Suddenly we have to invalidate a whole bunch of items in order for the UI to pick up the correct styles per item. Secondly, you’ll see that every other item is indented further than the item preceding it (both from the left and the right). But we’re going to get to derived classes later, and this is an instructive exercise besides.that is created on our behalf will point to the collection we supplied.