简体   繁体   中英

WP8/C# - Fill Grid From Collection?

I'm creating a sound board type app purely for learning purposes. What I would like to do is define a collection of Sound objects - my Sound object contains Name, File Path and Image properties - , and fill a grid with these objects.

Is it possible to fill a Grid from a collection? I know it can be done with a List, but I'm using a grid to lay out my sounds in XAML in a grid format.

This post shows how to create View Models of your data, and bind them to a grid:

DataBinding C# objects in Windows Phone
http://diggthedrazen.com/2011/07/07/binding-clr-objects-to-your-uiwindows-phone/

In this post we'll see how to bind a collection of items to a ListBox and generate simple templates for each ListBoxItem. We'll also look at C# and how to define collections and what types of collections should you use when binding data.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM