Chris Bos
Chris Bos

Reputation: 335

How to create "Add" Button item in Windows 8 GridView

I am creating a Windows 8 Metro UI. I want to create a "Add" Button similar to the "Places" view on the Weather app (Or any of the default apps really).

My GridView items are being pulled from a datasource as a List. I have created a empty object of my data type and added it to the List, then used the template selector to detect the "null" empty object and show the button.

But this seems a bit dirty, I have to manage the non data item when I serialize the data for storage etc... Just wondering if anyone had a better way of doing this?

Upvotes: 1

Views: 878

Answers (1)

N_A
N_A

Reputation: 19897

Create a property which exposes a copy of your list which has the additional null item added. This will allow you to keep your xaml as is and remove the need to filter it out when serializing.

Upvotes: 2

Related Questions