0

I have a Grid bound to an ObservableCollection. I want to have an extra item in the grid such that it displays as just another tile but is actually, e.g., a button. Microsoft's Finance app demonstrates the effect I want perfectly (screenshot below). The goal is to have a final tile that is not itself a member of the collection, but sits in the grid like any other item.

The top answer to a similar question mentions the CompositeCollection, but CompositeCollection does not seem to be available for Win8 apps.

Screenshot of Microsoft Finance app showing an extra grid item

Community
  • 1
  • 1
Russ Amos
  • 419
  • 3
  • 9

2 Answers2

1

You could always add and extra item at the end of the ObservableCollection, you're binding to.

  • You could handle this exception in the view model: add it during loading, properly handle adding and removing the rest of the items if you support that in your app. (That's the approach we took in one of our projects.)
  • Or you could derive your own class from ObservableCollection to handle all that and reuse it.

To have the extra item display differently from the others, you can use a DataTemplateSelector and select the right template based on the type name or some other property that differentiates the extra item from the rest.

Damir Arh
  • 17,637
  • 2
  • 45
  • 83
0

Here's sample project which shows standard items template (GridView, with ListView for snapped view) that adds a "+" content item to the ItemsSource, which is used for the "Add New Item" action in the app.

"Add New Item" item in GridView / ListView

Farhan Ghumra
  • 15,180
  • 6
  • 50
  • 115