コード例 #1
0
        private DataGridColumn BuildStudentLessonColumn(string id, LessonEntity entity)
        {
            var dataGridTemplateColumn =
                new TextColumn {
                Width    = new DataGridLength(90),
                MinWidth = 50,
                Header   = new TextBlock {
                    Text = Localization["common.lesson.type." + entity.LessonType] + "\n " +
                           entity.Date?.ToString("dd.MM"),
                    Foreground = entity.Id == _currentLesson.Id ? Brushes.Red : Brushes.Black
                },
                Binding = new Binding {
                    Path = new PropertyPath($"LessonToLessonMark[{id}].Mark")
                },
                CanUserSort = false
            };
            var cellStyle = new Style {
                BasedOn    = DataGridCellResources["StudentLessonMarkCell"] as Style,
                TargetType = typeof(DataGridCell)
            };
            var backGround = new Setter(Control.BackgroundProperty, new Binding($"LessonToLessonMark[{id}].Color"));
            var menu       = new Setter(FrameworkElement.ContextMenuProperty, BuildLessonCellContextMenu(id));

            cellStyle.Setters.Add(backGround);
            cellStyle.Setters.Add(menu);
            dataGridTemplateColumn.CellStyle = cellStyle;
            return(dataGridTemplateColumn);
        }
コード例 #2
0
        private DataGridColumn BuildMissedLessonsColumn()
        {
            var dataGridTemplateColumn =
                new TextColumn {
                Width  = new DataGridLength(80),
                Header = new TextBlock {
                    Text = Localization["Пропуски"]
                },
                Binding     = new Binding("MissedLessons"),
                IsReadOnly  = true,
                CanUserSort = false
            };

            return(dataGridTemplateColumn);
        }