private void addButton_Click(object sender, System.Windows.RoutedEventArgs e) { if (DataGridCollection.Count == 0) { DataGridCollection.Add(new Task() { Number = 1 }); } else { DataGridCollection.Add(new Task() { Number = DataGridCollection.Last().Number + 1 }); } }
private void addButton_Click(object sender, System.Windows.RoutedEventArgs e) { Pilot newPilot = null; if (DataGridCollection.Count == 0) { newPilot = new Pilot() { Number = 1 } } ; else { DataGridCollection.Sort(p => p.Number); newPilot = new Pilot() { Number = DataGridCollection.Max(p => p.Number) + 1 }; } DataGridCollection.Add(newPilot); }
private void addButton_Click(object sender, System.Windows.RoutedEventArgs e) { DataGridCollection.Add(new Competition()); }