views:

18

answers:

3

Can someone show me a system-enumerable that I can access quickly as an ItemsSource to get test-data. I do not care what type it returns. The amount of data is also not very relevant, 100 or 10000 items, I do not care.

The desired markup would then look something like the code below and idealy does not need any namespace-declaration:

<ListBox ItemsSource="{x:Static ASystemEnumerableThatReturnsSomeObjects}"/>
A: 

You can use the System.Net.HttpStatusCode enumeration and look at the following link to know how to use it as an items source. The given link demonstrates using an enum as the ItemSource for a ComboBox but you can use it with a ListBox as well.

rtdecl
Thanks for the answer, but I'm looking for something really short (for testing purposes).
HCL
+1  A: 

I like using String for testing, since it works as an enumerable of char. In .NET 4.0 you can use a string directly:

<ListBox ItemsSource="asdf"/>

For earlier versions, you could use a static property of type String:

<ListBox ItemsSource="{x:Static DataFormats.Text}"/>
Quartermeister
+1 Cool, I would never have discovered this.
HCL
+3  A: 

I'm a bit partial to using the system fonts for static xaml arrays:

<ListBox ItemsSource="{x:Static Fonts.SystemFontFamilies}"/>
Metro Smurf
+1 easy to remeber, good length, nice content, Thanks!
HCL