in my application I used visual studio 2012, MSSQL server 2012, wpf and linq. In there i have to populate a datagrid with data from a database. my datagrid is as below.
<DataGrid HorizontalAlignment="Left" Height="189" Margin="10,10,0,0" VerticalAlignment="Top" Width="351" Name="StudentGrid" SelectionChanged="StudentGrid_SelectionChanged">
<DataGrid.Columns>
<DataGridTextColumn Header="Student ID" Binding="{Binding Path=Student.StudentId}"/>
<DataGridTextColumn Header="First Name" Binding="{Binding Path=Student.FirstName}"/>
<DataGridTextColumn Header="Last Name" Binding="{Binding Path=Student.LastName}"/>
<DataGridTextColumn Header="Gender" Binding="{Binding Path=Student.Gender}"/>
</DataGrid.Columns>
</DataGrid>
and my widow loaded method is as below.
private void Window_Loaded(object sender, RoutedEventArgs e)
{
SchoolDataDataContext con = new SchoolDataDataContext();
List<Student> students = (from s in con.Students
select s).ToList<Student>();
StudentGrid.ItemsSource = students;
}
But when the program is executed the datagrid does not show single data although the student table in the database contain data.

how can I fix this.
ok I changed the datagrid as mentioned below answers as below but nothing changes.
<DataGrid AutoGenerateColumns="False" ItemsSource="{Binding}" HorizontalAlignment="Left" Height="191" Margin="23,24,0,0" VerticalAlignment="Top" Width="447" Name="StudentGrid" >
<DataGrid.Columns>
<DataGridTextColumn Header="Student ID" Binding="{Binding Path=StudentId}"/>
<DataGridTextColumn Header="First Name" Binding="{Binding Path=FirstName}"/>
<DataGridTextColumn Header="Last Name" Binding="{Binding Path=LastName}"/>
<DataGridTextColumn Header="Gender" Binding="{Binding Path=Gender}"/>
</DataGrid.Columns>
</DataGrid>