Lets say I have the following classes. My intention is to bind the List to list view. This is just a sample code. Please help.
Class Data
{
public string name {get;set;}
public DateTime date{get;set;}
}
Class Items
{
//Code to get items from database and create a list<Data>...
ListViewDetails.DataContext=List<Data>; //Not Sure if this is the right way...
}
XAML:
<ListView Name="ListViewDetails" Margin="4,20,40,100" ItemTemplate="{DynamicResource EmployeeTemplate}" ItemsSource="{Binding Path=List}">
<GridView>
<GridViewColumn Header="Employee Name" DisplayMemberBinding="{Binding Path=name}"/>
<GridViewColumn Header="Hire Date" DisplayMemberBinding="{Binding Path=date}"/>
</GridView>
</ListView>