private void BtnReload_Click(object sender, RoutedEventArgs e) { ObservableCollection <Result> newResults = _resultsModel.GetAll <Result>(); _results.Clear(); foreach (Result result in newResults) { _results.Add(result); } DGResults.SelectedIndex = -1; }
public ViewCompetition(Competition competition) { InitializeComponent(); Title = "SRA - #" + competition.Id.ToString() + " « " + competition.Name + " »"; _competition = competition; TxBCompetitionName.Text = "« " + competition.Name + " »"; TxBStartDate.Text = competition.StartDate.ToString("d MMMM yyyy"); TxBEndDate.Text = competition.EndDate.ToString("d MMMM yyyy"); _resultsModel = new ResultsModel(competition.Id); _resultsModel.CreateIfDontExist(); _results = _resultsModel.GetAll <Result>(); DGResults.ItemsSource = _results; }