I am reasonably new to C# and am struggling with some very basic things. The examples of using datagrid that I have found have been more complex, I just want a list which I can 'tick off' at the press of a button and add a timestamp to. Any ideas on how best to do this? Currently I have the following which obviously doesn't work.
C#
public class ListData
{
public int Number { get; set; }
public string Signature { get; set; }
}
List<ListData> LoadListData()
{
List<ListData> TableInfo = new List<ListData>();
TableInfo.Add(new ListData()
{
Number = 1,
});
TableInfo.Add(new ListData()
{
Number = 2,
});
TableInfo.Add(new ListData()
{
Number = 3,
});
return TableInfo;
}
private void Window_Loaded(object sender, RoutedEventArgs e)
{
DataGrid1.ItemsSource = LoadListData();
}
private void NextRow_Click(object sender, RoutedEventArgs e)
{
//update row i here
//add Signature = "J Doe " + DateTime.Now,
// i++
}
XAML
<DataGrid Height="200" HorizontalAlignment="Right" Name="DataGrid1" VerticalAlignment="Top" Width="400" />