Esempio n. 1
0
 /// <summary>
 /// Raises the PreviewCurrentChangingEvent without allowing canceling of the event.
 /// </summary>
 public void RaiseNonCancelablePreviewCurrentChangingEvent(object newValue)
 {
     if (inhibitChangeEvents.IsSet)
     {
         return;
     }
     if (PreviewCurrentChanging != null)
     {
         var eventArgs = new PreviewChangeEventArgs(CurrentItem, newValue, false);
         PreviewCurrentChanging(this, eventArgs);
     }
 }
 /// <summary>
 /// Raises the PreviewCurrentCellChangingEvent without allowing canceling of the event.
 /// </summary>
 public void RaiseNonCancelablePreviewCurrentCellChangingEvent(UniversalCellInfo newValue)
 {
     if (PreviewCurrentCellChanging != null)
     {
         var eventArgs = new PreviewChangeEventArgs(CurrentCell, newValue, false);
         PreviewCurrentCellChanging(this, eventArgs);
     }
     if (PreviewCurrentChanging != null && CurrentCell.Item != newValue.Item)
     {
         isCurrentItemChanged = true;
         var eventArgs = new PreviewChangeEventArgs(CurrentCell.Item, newValue.Item, false);
         PreviewCurrentChanging(this, eventArgs);
     }
 }
Esempio n. 3
0
 /// <summary>
 /// Raises the PreviewCurrentChangingEvent, allowing the handlers to cancel it,
 /// returning the result in 'canceled'
 /// </summary>
 ///
 /// <param name="canceled">Returns whether any of the event handlers canceled the event.</param>
 public void RaisePreviewCurrentChangingEvent(object newValue, out bool canceled)
 {
     canceled = false;
     if (inhibitChangeEvents.IsSet)
     {
         return;
     }
     if (PreviewCurrentChanging != null)
     {
         var eventArgs = new PreviewChangeEventArgs(CurrentItem, newValue, true);
         PreviewCurrentChanging(this, eventArgs);
         canceled = eventArgs.Canceled;
     }
 }
        private void CurrentItemTracker_PreviewCurrentChanging(object sender, PreviewChangeEventArgs previewChangeEventArgs)
        {
            if (ignoreCurrentItemChangedEvent.IsSet)
            {
                return;
            }

            bool shiftIsPressed   = (Keyboard.Modifiers & ModifierKeys.Shift) != 0;
            bool controlIsPressed = (Keyboard.Modifiers & ModifierKeys.Control) != 0;

            if (shiftIsPressed || controlIsPressed)
            {
                if (!DisableEditing())
                {
                    previewChangeEventArgs.Canceled = true;
                }
            }
        }
 /// <summary>
 /// Raises the PreviewCurrentCellChangingEvent, allowing the handlers to cancel it,
 /// returning the result in 'canceled'
 /// </summary>
 ///
 /// <param name="canceled">Returns whether any of the event handlers canceled the event.</param>
 public void RaisePreviewCurrentCellChangingEvent(UniversalCellInfo newValue, out bool canceled)
 {
     canceled = false;
     if (PreviewCurrentCellChanging != null)
     {
         var eventArgs = new PreviewChangeEventArgs(CurrentCell, newValue, true);
         PreviewCurrentCellChanging(this, eventArgs);
         canceled = eventArgs.Canceled;
     }
     if (!canceled)
     {
         if (PreviewCurrentChanging != null && CurrentCell.Item != newValue.Item)
         {
             var eventArgs = new PreviewChangeEventArgs(CurrentCell.Item, newValue.Item, false);
             PreviewCurrentChanging(this, eventArgs);
             canceled             = eventArgs.Canceled;
             isCurrentItemChanged = !canceled;
         }
     }
 }