private void AddNotenTextBox(Leistung l, int row, int column, bool italic = false, CellEditorTag tag = null, bool useeditor = false)
        {
            TextBox tb = new TextBox();

            if (l == null)
            {
                tb.Text = "";
            }
            else
            {
                tb.Text    = l.Notenstufe.ToString();
                tb.ToolTip = $"Erhoben am: {l.Erhebungsdatum} \r\n" +
                             (l.LetzteÄnderung != null ? $"Letzte Änderung: {l.LetzteÄnderung} \r\n" : "");
            }
            tb.TextAlignment     = TextAlignment.Center;
            tb.VerticalAlignment = VerticalAlignment.Center;
            tb.Margin            = new Thickness(MARGIN);
            tb.IsReadOnly        = true;

            if (tag != null)
            {
                tb.Tag = tag;
                if (useeditor)
                {
                    tb.MouseDoubleClick += (s, e) =>
                    {
                        TextBox sender = s as TextBox;
                        if (sender == null)
                        {
                            return;
                        }

                        CellEditorTag ctag = sender.Tag as CellEditorTag;
                        if (ctag == null)
                        {
                            return;
                        }

                        if (new LeistungsEditor(ctag).ShowDialog() == true)
                        {
                            UpdateNotenGrid();
                        }
                    }
                }
                ;
            }

            if (italic)
            {
                tb.FontStyle = FontStyles.Italic;
            }

            gNoten.Children.Add(tb);

            Grid.SetRow(tb, row);
            Grid.SetColumn(tb, column);
        }
        public LeistungsEditor(CellEditorTag tag)
        {
            InitializeComponent();

            _vm = FindResource("LeistungsEditorVM") as LeistungsEditorVM;
            _vm.SetMode(tag);

            EventHandler closer = null;

            _vm.CloseAfterSaveRequesting += closer = (s, e) =>
            {
                this.DialogResult = true;
                this.Close();
            };
            //Eventhandler abtrennen (sonst falls Fenster 2 mal hintereinander geöffnet und geschlossen --> beim 3ten mal 3 MessageBoxen die auf Event reagieren und aufgehen!)
            this.Closing += (s, e) =>
            {
                _vm.CloseAfterSaveRequesting -= closer;
            };

            this.Closing += LeistungsEditor_Closing;
        }