private void WorkoutDetailEditCommandBinding_OnExecuted(object sender, ExecutedRoutedEventArgs e) { if (e.Parameter is WorkoutDetail workoutDetail) { _workoutDetail = workoutDetail; GbWorkoutDetail.DataContext = workoutDetail; BtnAddWorkoutDetail.Content = new BitmapImage(new Uri("pack://application:,,,/Content/Images/Edit.png")); } }
private void ResetToAddWorkoutDetail(int workoutId, ListCollectionView workoutDetails) { var workout = _context.Workouts.Include(c => c.Student).SingleOrDefault(c => c.Id == workoutId); if (workout != null) { _workoutDetail = new WorkoutDetail() { WorkoutId = workoutId }; GbWorkoutDetail.DataContext = _workoutDetail; GbWorkoutDetail.Header = workout.Title; GbWorkoutDetail.IsEnabled = true; GrdWorkoutDetails.ItemsSource = workoutDetails; BtnAddWorkoutDetail.Content = new BitmapImage(new Uri("pack://application:,,,/Content/Images/add.png")); } }
public vwWorkouts(int studentId) { var splashScreen = new SplashScreenWindow(); splashScreen.Show(); InitializeComponent(); _studentId = studentId; CboWorkoutTitles.ItemsSource = _context.WorkoutTitles.ToList(); _workoutDetail = new WorkoutDetail(); _workout = new Workout() { StudentId = studentId }; GbWorkoutDetail.DataContext = _workoutDetail; GbWorkout.DataContext = _workout; BindGrid(); splashScreen.Close(); }