Ejemplo n.º 1
0
        private void myDG_CellEditEnding(object sender, DataGridCellEditEndingEventArgs e)
        {
            if (e.EditAction == DataGridEditAction.Commit)
            {
                var column = e.Column as DataGridBoundColumn;

                if (column != null)
                {
                    //var bindingPath = (column.Binding as Binding).Path.Path;

                    VerbTableEntry.Tense t = VerbTableEntry.TenseFromColumn(column.DisplayIndex - 1);

                    {
                        int rowIndex = e.Row.GetIndex();
                        var el       = e.EditingElement as TextBox;
                        // rowIndex has the row index
                        // bindingPath has the column's binding
                        // el.Text has the new, user-entered value

                        FrameworkElement fe   = e.Column.GetCellContent(e.Row);
                        VerbTableEntry   item = (VerbTableEntry)fe.DataContext;
                        item.SetValue(t, el.Text);

                        //if (!item.PresentMatch)
                        //((TextBox)fe).Background = Brushes.PaleVioletRed;

                        rowIndex++;
                        if (rowIndex > 5)
                        {
                            rowIndex = 0;
                        }

                        //Advance to next row (same column)

                        VerbDataGrid.SelectedCells.Clear();


                        //In order to invoke the cell colour style triggers - null out and reset the DG item source // frig!!
                        FlashGrid();

                        DataGridCell cell = DGUtil.GetCell(VerbDataGrid, rowIndex, column.DisplayIndex);
                        if (cell != null)
                        {
                            cell.IsSelected = true;
                            cell.Focus();
                            VerbDataGrid.BeginEdit();
                        }
                    }
                }
            }
        }
Ejemplo n.º 2
0
        public VerbTableEntry(string person, string pr, string im, string pret, string cond, string fut, bool createcopy = false)
        {
            Person = person;

            _items[0] = pr;
            _items[1] = pret;
            _items[2] = im;
            _items[3] = cond;
            _items[4] = fut;

            SetFlags();

            if (createcopy)
            {
                _master = new VerbTableEntry(person, pr, im, pret, cond, fut);
            }
        }