private void Dg_CellEditEnding(object sender, DataGridCellEditEndingEventArgs e) { UIMaxGapsPerDay maxGaps = e.Row.DataContext as UIMaxGapsPerDay; if (maxGaps != null) { maxGaps.IsChecked = true; } }
public void Initilize() { Messenger.Default.Register <HostView>(this, save); this.Comments = CommonDataManager.GetMixedRuleComments(MixedRuleEnum.TeacherMaxGapsPerDay); var cl = base.GetClCase(base.LocalID); // 绑定教师 int no = 0; List <UIMaxGapsPerDay> rules = new List <UIMaxGapsPerDay>(); cl.Teachers.ForEach(t => { UIMaxGapsPerDay teacherRule = new UIMaxGapsPerDay() { CourseID = string.Empty, MaxGaps = 1, TeacherID = t.ID, Teacher = t.Name, Courses = cl.GetCourses(t.ID), NO = ++no, }; rules.Add(teacherRule); }); this.Rules = rules; // 绑定教师状态 var rule = base.GetClRule(base.LocalID); rule.MaxGapsPerDay.ForEach(h => { var first = this.Rules.FirstOrDefault(r => r.TeacherID.Equals(h.TeacherID)); if (first != null) { first.IsChecked = true; first.MaxGaps = h.MaxIntervel; first.Weight = (Models.Enums.WeightTypeEnum)h.Weight; } }); }