private void Groupe_2_Click(object sender, RoutedEventArgs e) { this.Groupe_1.Background = new SolidColorBrush(Color.FromRgb(67, 67, 67)); this.Groupe_1.Foreground = new SolidColorBrush(Color.FromRgb(222, 222, 222)); this.Groupe_2.Background = new SolidColorBrush(Color.FromRgb(222, 222, 222)); this.Groupe_2.Foreground = new SolidColorBrush(Color.FromRgb(254, 95, 27)); this.Groupe_3.Background = new SolidColorBrush(Color.FromRgb(67, 67, 67)); this.Groupe_3.Foreground = new SolidColorBrush(Color.FromRgb(222, 222, 222)); this.Groupe_4.Background = new SolidColorBrush(Color.FromRgb(67, 67, 67)); this.Groupe_4.Foreground = new SolidColorBrush(Color.FromRgb(222, 222, 222)); using (ExerciseContext db = new ExerciseContext()) { var panel = new StackPanel(); db.Exercises.Load(); var list = db.Exercises.Local.ToBindingList(); foreach (var item in list) { if (item.Groupe == 2) { var a = new Exercise_block_check(item, this); panel.Children.Add(a); } } this.List_train.Content = panel; } }
public Create_train(User us, DoubleWin w) { user = us; InitializeComponent(); win_c = w; var panel = new StackPanel(); using (ExerciseContext db = new ExerciseContext()) { db.Exercises.Load(); var list = db.Exercises.Local.ToBindingList(); foreach (var item in list) { var a = new Exercise_block_check(item, this); list_ex.Add(item); panel.Children.Add(a); } } this.List_train.Content = panel; }