Let's say I have a class Person:
public class Person
{
public string Name {get; set;}
public int Age {get; set;}
}
I would like to create some sample data in Blend to help me design my user interface visually. I choose to create sample data based on a class in Blend, but what I get is a sample Person - singular. I want to create a collection of Person to bnd to a list box. How do I tell it to do this? I can't find anywhere where it asks. Do I have to create a class that is a collection of Person. Surely there has to be a way to do this?
Thanks in advance.
I found a way to do this, though not ideal.
The creation of sample data based on a class is a one-time thing. Here's what I did to get my list of Person objects in sample data:
public class Person
{
public string Name {get; set;}
public int Age {get; set;}
}
public class PersonCollection : List<Person> {}
I created the PersonCollection class, which is simply a collection of Person objects. I then created my sample data based on the PersonCollection class - giving me the sample data I was after. I then removed the PersonCollection, leaving the sample data in place.
I'd call this a workaround rather than a solution. If anyone can offer a true solution - a way to do this in Blend without having to create summy classes, I'll be more than happy to mark that as the solution.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With