I understand I posted this question, but having accepted the answer on my last question and following through the article I realized it wasn't the answer I was looking for. I've posted again with some sample code.
I want to fill a Grid (not a DataGrid) with Data from a collection. Here is what I have but it does not work. If I remove the collection and set the DataContext to a single object it works, but not as a collection.
XAML
Grid x:Name="ContentPanel" Grid.Row="1" Margin="12,0,12,0">
<StackPanel>
<TextBlock Text="{Binding Path=StudentName}" />
</StackPanel>
</Grid>
MainPage.xaml.cs
public MainPage()
{
InitializeComponent();
ObservableCollection<Student> ob = new ObservableCollection<Student>();
ob.Add(new Student()
{
StudentName = "James Jeffery"
});
ob.Add(new Student()
{
StudentName = "Sian Ellis"
});
this.DataContext = ob;
// Sample code to localize the ApplicationBar
//BuildLocalizedApplicationBar();
}
This has been bugging me for hours. I just can't seem to fill a grid with a collection. Every example on Google shows ListViews etc. I want to fill a Grid, and only a Grid.
Any advice on how to achieve this?