コード例 #1
0
                protected sealed override void OpenEdit(RowManager rowManager)
                {
                    Debug.Assert(rowManager == RowManager);

                    KeepInitialInputElement(rowManager);

                    if (rowManager.VirtualRow != null)
                    {
                        _insertingRow         = rowManager.VirtualRow;
                        _insertingRow.DataRow = DataSet.BeginAdd();
                    }
                    else
                    {
                        _insertingRow = new RowPresenter(rowManager, DataSet.BeginAdd());
                    }
                    _insertingRow.RawIndex = InsertingRowRawIndex;

                    if (rowManager.VirtualRowPlacement == VirtualRowPlacement.Head)
                    {
                        rowManager.VirtualRow = new RowPresenter(rowManager, 0);
                    }
                    else if (rowManager.VirtualRowPlacement == VirtualRowPlacement.Tail)
                    {
                        rowManager.VirtualRow = new RowPresenter(rowManager, -1);
                    }
                    else if (rowManager.VirtualRow != null)
                    {
                        rowManager.VirtualRow = null;
                    }
                    rowManager.Editing = this;
                    rowManager.OnRowsChanged();
                    rowManager.SetCurrentRow(_insertingRow, false);
                }
コード例 #2
0
                protected sealed override RowPresenter CommitEdit(RowManager rowManager, bool staysOnInserting)
                {
                    Debug.Assert(!rowManager.IsEditing);
                    Debug.Assert(rowManager == RowManager);

                    DisposeInsertingRow(false);
                    var newDataRow    = DataSet.EndAdd(CommitEditIndex);
                    var newCurrentRow = rowManager[newDataRow];

                    if (!rowManager.CurrentRowChangeSuspended)
                    {
                        if (newCurrentRow != null)
                        {
                            rowManager.CurrentRow = newCurrentRow;
                        }
                    }

                    if (staysOnInserting)
                    {
                        StayOnInserting(rowManager, newCurrentRow);
                        var currentView = rowManager.CurrentRow?.View;
                        if (currentView != null && currentView.ContainsKeyboardFocus() && InitialInputElement != null && InitialInputElement != currentView.ActiveInputElement &&
                            (InitialInputElement as DependencyObject).FindVisaulAncestor <RowView>() == currentView)
                        {
                            InitialInputElement.Focus();
                        }
                    }
                    return(newCurrentRow);
                }
コード例 #3
0
 public override void OnRowsChanged(RowManager rowManager)
 {
     if (rowManager.CurrentRow.IsDisposed)
     {
         CancelEdit(rowManager);
     }
 }
コード例 #4
0
 protected InsertHandler(RowManager rowManager, RowPresenter reference)
 {
     Debug.Assert(rowManager != null);
     Debug.Assert(reference == null || reference.RowManager == rowManager);
     RowManager = rowManager;
     Reference  = reference;
 }
コード例 #5
0
                protected override RowPresenter CommitEdit(RowManager rowManager, bool staysOnInserting)
                {
                    var currentRow = rowManager.CurrentRow;

                    currentRow.DataRow.EndEdit();
                    return(currentRow);
                }
コード例 #6
0
                protected sealed override void RollbackEdit(RowManager rowManager)
                {
                    Debug.Assert(!rowManager.IsEditing);
                    Debug.Assert(rowManager == RowManager);

                    DataSet.CancelAdd();
                    DisposeInsertingRow(true);
                }
コード例 #7
0
                private void KeepInitialInputElement(RowManager rowManager)
                {
                    var currentView = rowManager.CurrentRow?.View;

                    if (currentView != null)
                    {
                        InitialInputElement = currentView.ActiveInputElement;
                    }
                }
コード例 #8
0
 private void DisposeInsertingRow(bool isRollback)
 {
     _insertingRow.DataRow = null;
     _insertingRow.Dispose();
     if (isRollback)
     {
         RowManager._suggestedCurrentRow = CurrentRowAfterRollback;
         RowManager.OnRowsChanged();
     }
 }
コード例 #9
0
 public override void OnRowsChanged(RowManager rowManager)
 {
     if (Reference != null)
     {
         if (Reference.IsDisposed)
         {
             Reference = ReferenceForDisposed;
         }
         else
         {
             RefreshReferenceRawIndex();
         }
     }
     if (rowManager.VirtualRowPlacement == VirtualRowPlacement.Tail)
     {
         rowManager.VirtualRow.RawIndex = rowManager.Rows.Count - 1;
     }
     if (InsertingRow != null)
     {
         InsertingRow.RawIndex = InsertingRowRawIndex;
     }
 }
コード例 #10
0
            private static EditHandler GetCurrentRowEditHandler(RowManager rowManager)
            {
                var currentRow = rowManager.CurrentRow;

                if (currentRow.IsVirtual)
                {
                    var virtualRowPlacement = rowManager.VirtualRowPlacement;
                    if (virtualRowPlacement == VirtualRowPlacement.Head)
                    {
                        return(InsertHandler.EditVirtualHead(rowManager));
                    }
                    else
                    {
                        Debug.Assert(virtualRowPlacement == VirtualRowPlacement.Tail);
                        return(InsertHandler.EditVirtualTail(rowManager));
                    }
                }
                else
                {
                    return(EditCurrentHandler.Singleton);
                }
            }
コード例 #11
0
 public InsertAfterHandler(RowManager rowManager, RowPresenter reference)
     : base(rowManager, reference)
 {
 }
コード例 #12
0
 protected override void StayOnInserting(RowManager rowManager, RowPresenter rowInserted)
 {
     rowManager.BeginInsertBefore(null, rowInserted);
 }
コード例 #13
0
 public static InsertHandler After(RowManager rowManager, RowPresenter reference)
 {
     return(new InsertAfterHandler(rowManager, reference));
 }
コード例 #14
0
 public static InsertHandler Before(RowManager rowManager, RowPresenter reference)
 {
     return(new InsertBeforeHandler(rowManager, reference));
 }
コード例 #15
0
 public EditVirtualTailHandler(RowManager rowManager)
     : base(rowManager, null)
 {
 }
コード例 #16
0
 protected override void StayOnInserting(RowManager rowManager, RowPresenter rowInserted)
 {
     Debug.Assert(rowManager.VirtualRow != null);
     rowManager.CurrentRow = rowManager.VirtualRow;
 }
コード例 #17
0
 protected abstract void StayOnInserting(RowManager rowManager, RowPresenter rowInserted);