I would like to declare some data in my Silverlight for Windows Phone 7 application. I’m not sure what the syntax is.
For example:
public class Person
{
public string Name {get; set;}
public int Age {get; set;}
}
<Application.Resources>
<Data x:Name="People">
<Person Age="2" Name="Sam" />
<!-- ... -->
</Data>
</Application.Resources>
Obviously Data is not a valid tag. What do I want here?
You will need to define a container type first of all:-
You then need to add the namespace that your People/Person classes are present in to the Xaml typicall this would look like:-
Just replace “SilverlightApplication1” with your application namespace.
Now you can do:-