本文整理汇总了C#中ExecutedRoutedEventHandler类的典型用法代码示例。如果您正苦于以下问题:C# ExecutedRoutedEventHandler类的具体用法?C# ExecutedRoutedEventHandler怎么用?C# ExecutedRoutedEventHandler使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ExecutedRoutedEventHandler类属于命名空间,在下文中一共展示了ExecutedRoutedEventHandler类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: AddCommandPreviewExecuteHandler
public static void AddCommandPreviewExecuteHandler(this CommandBindingCollection collection, RoutedCommand command, ExecutedRoutedEventHandler handler)
{
CommandBinding binding = GetOrCreateBinding(collection, command);
// Remove the handler if it already exist
binding.PreviewExecuted -= handler;
binding.PreviewExecuted += handler;
}
示例2: _RegisterClassHandlers
internal static void _RegisterClassHandlers(Type controlType, bool acceptsRichContent, bool readOnly, bool registerEventListeners)
{
CommandHelpers.RegisterCommandHandler(controlType, ApplicationCommands.Copy, new ExecutedRoutedEventHandler(OnCopy), new CanExecuteRoutedEventHandler(OnQueryStatusCopy), KeyGesture.CreateFromResourceStrings(SR.Get(SRID.KeyCopy), SR.Get(SRID.KeyCopyDisplayString)), KeyGesture.CreateFromResourceStrings(SR.Get(SRID.KeyCtrlInsert), SR.Get(SRID.KeyCtrlInsertDisplayString)));
if (acceptsRichContent)
{
CommandHelpers.RegisterCommandHandler(controlType, EditingCommands.CopyFormat, new ExecutedRoutedEventHandler(OnCopyFormat), new CanExecuteRoutedEventHandler(OnQueryStatusCopyFormat), SRID.KeyCopyFormat, SRID.KeyCopyFormatDisplayString);
}
if (!readOnly)
{
CommandHelpers.RegisterCommandHandler(controlType, ApplicationCommands.Cut, new ExecutedRoutedEventHandler(OnCut), new CanExecuteRoutedEventHandler(OnQueryStatusCut), KeyGesture.CreateFromResourceStrings(SR.Get(SRID.KeyCut), SR.Get(SRID.KeyCutDisplayString)), KeyGesture.CreateFromResourceStrings(SR.Get(SRID.KeyShiftDelete), SR.Get(SRID.KeyShiftDeleteDisplayString)));
// temp vars to reduce code under elevation
ExecutedRoutedEventHandler ExecutedRoutedEventHandler = new ExecutedRoutedEventHandler(OnPaste);
CanExecuteRoutedEventHandler CanExecuteRoutedEventHandler = new CanExecuteRoutedEventHandler(OnQueryStatusPaste);
InputGesture inputGesture = KeyGesture.CreateFromResourceStrings(SR.Get(SRID.KeyShiftInsert), SR.Get(SRID.KeyShiftInsertDisplayString));
new UIPermission(UIPermissionClipboard.AllClipboard).Assert(); //BlessedAssert
try
{
CommandHelpers.RegisterCommandHandler(controlType, ApplicationCommands.Paste, ExecutedRoutedEventHandler, CanExecuteRoutedEventHandler, inputGesture);
}
finally
{
CodeAccessPermission.RevertAssert();
}
if (acceptsRichContent)
{
CommandHelpers.RegisterCommandHandler(controlType, EditingCommands.PasteFormat, new ExecutedRoutedEventHandler(OnPasteFormat), new CanExecuteRoutedEventHandler(OnQueryStatusPasteFormat), SRID.KeyPasteFormat, SRID.KeyPasteFormatDisplayString);
}
}
}
示例3: AsyncCommandBinding
public AsyncCommandBinding(ICommand command, ExecutedRoutedEventHandler executed, CanExecuteRoutedEventHandler canExecute, RunWorkerCompletedEventHandler runWokrerCompleted)
{
if (command == null)
{
throw new ArgumentNullException("command");
}
_task = new BackgroundWorker();
_task.DoWork += delegate
{
executed(null, null);
};
_task.RunWorkerCompleted += (s, e) =>
{
runWokrerCompleted(s, e);
_task.Dispose();
};
Command = command;
if (executed != null)
{
Executed += delegate
{
if (!_task.IsBusy)
_task.RunWorkerAsync();
};
}
if (canExecute != null)
{
CanExecute += canExecute;
}
}
示例4: _RegisterClassHandlers
//-----------------------------------------------------
//
// Class Internal Methods
//
//-----------------------------------------------------
#region Class Internal Methods
/// <summary>
/// Registes all handlers needed for text editing control functioning.
/// </summary>
/// <param name="controlType">
/// A type of control for which typing component is registered
/// </param>
/// <param name="registerEventListeners">
/// If registerEventListeners is false, caller is responsible for calling OnXXXEvent methods on TextEditor from
/// UIElement and FrameworkElement virtual overrides (piggy backing on the
/// UIElement/FrameworkElement class listeners). If true, TextEditor will register
/// its own class listener for events it needs.
///
/// This method will always register private command listeners.
/// </param>
internal static void _RegisterClassHandlers(Type controlType, bool registerEventListeners)
{
if (registerEventListeners)
{
EventManager.RegisterClassHandler(controlType, Keyboard.PreviewKeyDownEvent, new KeyEventHandler(OnPreviewKeyDown));
EventManager.RegisterClassHandler(controlType, Keyboard.KeyDownEvent, new KeyEventHandler(OnKeyDown));
EventManager.RegisterClassHandler(controlType, Keyboard.KeyUpEvent, new KeyEventHandler(OnKeyUp));
EventManager.RegisterClassHandler(controlType, TextCompositionManager.TextInputEvent, new TextCompositionEventHandler(OnTextInput));
}
var onEnterBreak = new ExecutedRoutedEventHandler(OnEnterBreak);
var onSpace = new ExecutedRoutedEventHandler(OnSpace);
var onQueryStatusNYI = new CanExecuteRoutedEventHandler(OnQueryStatusNYI);
var onQueryStatusEnterBreak = new CanExecuteRoutedEventHandler(OnQueryStatusEnterBreak);
EventManager.RegisterClassHandler(controlType, Mouse.MouseMoveEvent, new MouseEventHandler(OnMouseMove), true /* handledEventsToo */);
EventManager.RegisterClassHandler(controlType, Mouse.MouseLeaveEvent, new MouseEventHandler(OnMouseLeave), true /* handledEventsToo */);
CommandHelpers.RegisterCommandHandler(controlType, ApplicationCommands.CorrectionList , new ExecutedRoutedEventHandler(OnCorrectionList) , new CanExecuteRoutedEventHandler(OnQueryStatusCorrectionList) , SRID.KeyCorrectionList, SRID.KeyCorrectionListDisplayString );
CommandHelpers.RegisterCommandHandler(controlType, EditingCommands.ToggleInsert , new ExecutedRoutedEventHandler(OnToggleInsert) , onQueryStatusNYI , SRID.KeyToggleInsert, SRID.KeyToggleInsertDisplayString );
CommandHelpers.RegisterCommandHandler(controlType, EditingCommands.Delete , new ExecutedRoutedEventHandler(OnDelete) , onQueryStatusNYI , SRID.KeyDelete, SRID.KeyDeleteDisplayString );
CommandHelpers.RegisterCommandHandler(controlType, EditingCommands.DeleteNextWord , new ExecutedRoutedEventHandler(OnDeleteNextWord) , onQueryStatusNYI , SRID.KeyDeleteNextWord, SRID.KeyDeleteNextWordDisplayString );
CommandHelpers.RegisterCommandHandler(controlType, EditingCommands.DeletePreviousWord , new ExecutedRoutedEventHandler(OnDeletePreviousWord) , onQueryStatusNYI , SRID.KeyDeletePreviousWord, SRID.KeyDeletePreviousWordDisplayString );
CommandHelpers.RegisterCommandHandler(controlType, EditingCommands.EnterParagraphBreak , onEnterBreak , onQueryStatusEnterBreak , SRID.KeyEnterParagraphBreak, SRID.KeyEnterParagraphBreakDisplayString );
CommandHelpers.RegisterCommandHandler(controlType, EditingCommands.EnterLineBreak , onEnterBreak , onQueryStatusEnterBreak , SRID.KeyEnterLineBreak, SRID.KeyEnterLineBreakDisplayString );
CommandHelpers.RegisterCommandHandler(controlType, EditingCommands.TabForward , new ExecutedRoutedEventHandler(OnTabForward) , new CanExecuteRoutedEventHandler(OnQueryStatusTabForward) , SRID.KeyTabForward, SRID.KeyTabForwardDisplayString );
CommandHelpers.RegisterCommandHandler(controlType, EditingCommands.TabBackward , new ExecutedRoutedEventHandler(OnTabBackward) , new CanExecuteRoutedEventHandler(OnQueryStatusTabBackward) , SRID.KeyTabBackward, SRID.KeyTabBackwardDisplayString );
CommandHelpers.RegisterCommandHandler(controlType, EditingCommands.Space , onSpace , onQueryStatusNYI , SRID.KeySpace, SRID.KeySpaceDisplayString );
CommandHelpers.RegisterCommandHandler(controlType, EditingCommands.ShiftSpace , onSpace , onQueryStatusNYI , SRID.KeyShiftSpace, SRID.KeyShiftSpaceDisplayString );
CommandHelpers.RegisterCommandHandler(controlType, EditingCommands.Backspace , new ExecutedRoutedEventHandler(OnBackspace) , onQueryStatusNYI , KeyGesture.CreateFromResourceStrings(SR.Get(SRID.KeyBackspace), SR.Get(SRID.KeyBackspaceDisplayString)), KeyGesture.CreateFromResourceStrings(SR.Get(SRID.KeyShiftBackspace), SR.Get(SRID.KeyShiftBackspaceDisplayString)) );
}
示例5: RegisterCommandHandler
internal static void RegisterCommandHandler(Type controlType, RoutedCommand command, ExecutedRoutedEventHandler executedRoutedEventHandler,
CanExecuteRoutedEventHandler canExecuteRoutedEventHandler,
InputGesture inputGesture, InputGesture inputGesture2, InputGesture inputGesture3, InputGesture inputGesture4)
{
PrivateRegisterCommandHandler(controlType, command, executedRoutedEventHandler, canExecuteRoutedEventHandler,
inputGesture, inputGesture2, inputGesture3, inputGesture4);
}
示例6: RemoveCommandExecutedHandler
public static void RemoveCommandExecutedHandler(this CommandBindingCollection collection, RoutedCommand command, ExecutedRoutedEventHandler handler)
{
CommandBinding binding = GetBinding(collection, command);
if (binding != null)
{
binding.Executed -= handler;
}
}
示例7: SetCommandBinding
public static void SetCommandBinding(CommandBindingCollection commandCollection, ICommand command,
ExecutedRoutedEventHandler executed, CanExecuteRoutedEventHandler canExecute = null)
{
var binding = (canExecute == null)
? new CommandBinding(command, executed)
: new CommandBinding(command, executed, canExecute);
commandCollection.Remove(binding);
commandCollection.Add(binding);
}
示例8: CreateInputGesture
/// <summary>
/// Creates the input gesture.
/// </summary>
/// <param name="element">The element.</param>
/// <param name="key">The key to listen to.</param>
/// <param name="modifierKeys">The modifier keys to listen to.</param>
/// <param name="execute">The command to execute.</param>
/// <param name="canExecute">The command to check if the main command can execute.</param>
public static void CreateInputGesture(this UIElement element, Key key, ModifierKeys modifierKeys, ExecutedRoutedEventHandler execute, CanExecuteRoutedEventHandler canExecute)
{
var command = new RoutedUICommand();
var binding = new CommandBinding(command, execute, canExecute);
var gesture = new KeyGesture(key, modifierKeys);
var keyBinding = new KeyBinding(command, gesture);
element.CommandBindings.Add(binding);
element.InputBindings.Add(keyBinding);
}
示例9: _RegisterClassHandlers
internal static void _RegisterClassHandlers(Type controlType, bool registerEventListeners)
{
// Shared handlers used multiple times below.
ExecutedRoutedEventHandler nyiCommandHandler = new ExecutedRoutedEventHandler(OnNYICommand);
CanExecuteRoutedEventHandler queryStatusCaretNavigationHandler = new CanExecuteRoutedEventHandler(OnQueryStatusCaretNavigation);
CanExecuteRoutedEventHandler queryStatusKeyboardSelectionHandler = new CanExecuteRoutedEventHandler(OnQueryStatusKeyboardSelection);
// Standard Commands: Select All
// -----------------------------
CommandHelpers.RegisterCommandHandler(controlType, ApplicationCommands.SelectAll, new ExecutedRoutedEventHandler(OnSelectAll), queryStatusKeyboardSelectionHandler, SRID.KeySelectAll, SRID.KeySelectAllDisplayString);
// Editing Commands : Caret Navigation
// -----------------------------------
CommandHelpers.RegisterCommandHandler(controlType, EditingCommands.MoveRightByCharacter, new ExecutedRoutedEventHandler(OnMoveRightByCharacter), queryStatusCaretNavigationHandler, SRID.KeyMoveRightByCharacter, SRID.KeyMoveRightByCharacterDisplayString);
CommandHelpers.RegisterCommandHandler(controlType, EditingCommands.MoveLeftByCharacter, new ExecutedRoutedEventHandler(OnMoveLeftByCharacter), queryStatusCaretNavigationHandler, SRID.KeyMoveLeftByCharacter, SRID.KeyMoveLeftByCharacterDisplayString);
CommandHelpers.RegisterCommandHandler(controlType, EditingCommands.MoveRightByWord, new ExecutedRoutedEventHandler(OnMoveRightByWord), queryStatusCaretNavigationHandler, SRID.KeyMoveRightByWord, SRID.KeyMoveRightByWordDisplayString);
CommandHelpers.RegisterCommandHandler(controlType, EditingCommands.MoveLeftByWord, new ExecutedRoutedEventHandler(OnMoveLeftByWord), queryStatusCaretNavigationHandler, SRID.KeyMoveLeftByWord, SRID.KeyMoveLeftByWordDisplayString);
CommandHelpers.RegisterCommandHandler(controlType, EditingCommands.MoveDownByLine, new ExecutedRoutedEventHandler(OnMoveDownByLine), queryStatusCaretNavigationHandler, SRID.KeyMoveDownByLine, SRID.KeyMoveDownByLineDisplayString);
CommandHelpers.RegisterCommandHandler(controlType, EditingCommands.MoveUpByLine, new ExecutedRoutedEventHandler(OnMoveUpByLine), queryStatusCaretNavigationHandler, SRID.KeyMoveUpByLine, SRID.KeyMoveUpByLineDisplayString);
CommandHelpers.RegisterCommandHandler(controlType, EditingCommands.MoveDownByParagraph, new ExecutedRoutedEventHandler(OnMoveDownByParagraph), queryStatusCaretNavigationHandler, SRID.KeyMoveDownByParagraph, SRID.KeyMoveDownByParagraphDisplayString);
CommandHelpers.RegisterCommandHandler(controlType, EditingCommands.MoveUpByParagraph, new ExecutedRoutedEventHandler(OnMoveUpByParagraph), queryStatusCaretNavigationHandler, SRID.KeyMoveUpByParagraph, SRID.KeyMoveUpByParagraphDisplayString);
CommandHelpers.RegisterCommandHandler(controlType, EditingCommands.MoveDownByPage, new ExecutedRoutedEventHandler(OnMoveDownByPage), queryStatusCaretNavigationHandler, SRID.KeyMoveDownByPage, SRID.KeyMoveDownByPageDisplayString);
CommandHelpers.RegisterCommandHandler(controlType, EditingCommands.MoveUpByPage, new ExecutedRoutedEventHandler(OnMoveUpByPage), queryStatusCaretNavigationHandler, SRID.KeyMoveUpByPage, SRID.KeyMoveUpByPageDisplayString);
CommandHelpers.RegisterCommandHandler(controlType, EditingCommands.MoveToLineStart, new ExecutedRoutedEventHandler(OnMoveToLineStart), queryStatusCaretNavigationHandler, SRID.KeyMoveToLineStart, SRID.KeyMoveToLineStartDisplayString);
CommandHelpers.RegisterCommandHandler(controlType, EditingCommands.MoveToLineEnd, new ExecutedRoutedEventHandler(OnMoveToLineEnd), queryStatusCaretNavigationHandler, SRID.KeyMoveToLineEnd, SRID.KeyMoveToLineEndDisplayString);
CommandHelpers.RegisterCommandHandler(controlType, EditingCommands.MoveToColumnStart, nyiCommandHandler, queryStatusCaretNavigationHandler, SRID.KeyMoveToColumnStart, SRID.KeyMoveToColumnStartDisplayString);
CommandHelpers.RegisterCommandHandler(controlType, EditingCommands.MoveToColumnEnd, nyiCommandHandler, queryStatusCaretNavigationHandler, SRID.KeyMoveToColumnEnd, SRID.KeyMoveToColumnEndDisplayString);
CommandHelpers.RegisterCommandHandler(controlType, EditingCommands.MoveToWindowTop, nyiCommandHandler, queryStatusCaretNavigationHandler, SRID.KeyMoveToWindowTop, SRID.KeyMoveToWindowTopDisplayString);
CommandHelpers.RegisterCommandHandler(controlType, EditingCommands.MoveToWindowBottom, nyiCommandHandler, queryStatusCaretNavigationHandler, SRID.KeyMoveToWindowBottom, SRID.KeyMoveToWindowBottomDisplayString);
CommandHelpers.RegisterCommandHandler(controlType, EditingCommands.MoveToDocumentStart, new ExecutedRoutedEventHandler(OnMoveToDocumentStart), queryStatusCaretNavigationHandler, SRID.KeyMoveToDocumentStart, SRID.KeyMoveToDocumentStartDisplayString);
CommandHelpers.RegisterCommandHandler(controlType, EditingCommands.MoveToDocumentEnd, new ExecutedRoutedEventHandler(OnMoveToDocumentEnd), queryStatusCaretNavigationHandler, SRID.KeyMoveToDocumentEnd, SRID.KeyMoveToDocumentEndDisplayString);
// Editing Commands: Selection Building
// ------------------------------------
CommandHelpers.RegisterCommandHandler(controlType, EditingCommands.SelectRightByCharacter, new ExecutedRoutedEventHandler(OnSelectRightByCharacter), queryStatusKeyboardSelectionHandler, SRID.KeySelectRightByCharacter, SRID.KeySelectRightByCharacterDisplayString);
CommandHelpers.RegisterCommandHandler(controlType, EditingCommands.SelectLeftByCharacter, new ExecutedRoutedEventHandler(OnSelectLeftByCharacter), queryStatusKeyboardSelectionHandler, SRID.KeySelectLeftByCharacter, SRID.KeySelectLeftByCharacterDisplayString);
CommandHelpers.RegisterCommandHandler(controlType, EditingCommands.SelectRightByWord, new ExecutedRoutedEventHandler(OnSelectRightByWord), queryStatusKeyboardSelectionHandler, SRID.KeySelectRightByWord, SRID.KeySelectRightByWordDisplayString);
CommandHelpers.RegisterCommandHandler(controlType, EditingCommands.SelectLeftByWord, new ExecutedRoutedEventHandler(OnSelectLeftByWord), queryStatusKeyboardSelectionHandler, SRID.KeySelectLeftByWord, SRID.KeySelectLeftByWordDisplayString);
CommandHelpers.RegisterCommandHandler(controlType, EditingCommands.SelectDownByLine, new ExecutedRoutedEventHandler(OnSelectDownByLine), queryStatusKeyboardSelectionHandler, SRID.KeySelectDownByLine, SRID.KeySelectDownByLineDisplayString);
CommandHelpers.RegisterCommandHandler(controlType, EditingCommands.SelectUpByLine, new ExecutedRoutedEventHandler(OnSelectUpByLine), queryStatusKeyboardSelectionHandler, SRID.KeySelectUpByLine, SRID.KeySelectUpByLineDisplayString);
CommandHelpers.RegisterCommandHandler(controlType, EditingCommands.SelectDownByParagraph, new ExecutedRoutedEventHandler(OnSelectDownByParagraph), queryStatusKeyboardSelectionHandler, SRID.KeySelectDownByParagraph, SRID.KeySelectDownByParagraphDisplayString);
CommandHelpers.RegisterCommandHandler(controlType, EditingCommands.SelectUpByParagraph, new ExecutedRoutedEventHandler(OnSelectUpByParagraph), queryStatusKeyboardSelectionHandler, SRID.KeySelectUpByParagraph, SRID.KeySelectUpByParagraphDisplayString);
CommandHelpers.RegisterCommandHandler(controlType, EditingCommands.SelectDownByPage, new ExecutedRoutedEventHandler(OnSelectDownByPage), queryStatusKeyboardSelectionHandler, SRID.KeySelectDownByPage, SRID.KeySelectDownByPageDisplayString);
CommandHelpers.RegisterCommandHandler(controlType, EditingCommands.SelectUpByPage, new ExecutedRoutedEventHandler(OnSelectUpByPage), queryStatusKeyboardSelectionHandler, SRID.KeySelectUpByPage, SRID.KeySelectUpByPageDisplayString);
CommandHelpers.RegisterCommandHandler(controlType, EditingCommands.SelectToLineStart, new ExecutedRoutedEventHandler(OnSelectToLineStart), queryStatusKeyboardSelectionHandler, SRID.KeySelectToLineStart, SRID.KeySelectToLineStartDisplayString);
CommandHelpers.RegisterCommandHandler(controlType, EditingCommands.SelectToLineEnd, new ExecutedRoutedEventHandler(OnSelectToLineEnd), queryStatusKeyboardSelectionHandler, SRID.KeySelectToLineEnd, SRID.KeySelectToLineEndDisplayString);
CommandHelpers.RegisterCommandHandler(controlType, EditingCommands.SelectToColumnStart, nyiCommandHandler, queryStatusKeyboardSelectionHandler, SRID.KeySelectToColumnStart, SRID.KeySelectToColumnStartDisplayString);
CommandHelpers.RegisterCommandHandler(controlType, EditingCommands.SelectToColumnEnd, nyiCommandHandler, queryStatusKeyboardSelectionHandler, SRID.KeySelectToColumnEnd, SRID.KeySelectToColumnEndDisplayString);
CommandHelpers.RegisterCommandHandler(controlType, EditingCommands.SelectToWindowTop, nyiCommandHandler, queryStatusKeyboardSelectionHandler, SRID.KeySelectToWindowTop, SRID.KeySelectToWindowTopDisplayString);
CommandHelpers.RegisterCommandHandler(controlType, EditingCommands.SelectToWindowBottom, nyiCommandHandler, queryStatusKeyboardSelectionHandler, SRID.KeySelectToWindowBottom, SRID.KeySelectToWindowBottomDisplayString);
CommandHelpers.RegisterCommandHandler(controlType, EditingCommands.SelectToDocumentStart, new ExecutedRoutedEventHandler(OnSelectToDocumentStart), queryStatusKeyboardSelectionHandler, SRID.KeySelectToDocumentStart, SRID.KeySelectToDocumentStartDisplayString);
CommandHelpers.RegisterCommandHandler(controlType, EditingCommands.SelectToDocumentEnd, new ExecutedRoutedEventHandler(OnSelectToDocumentEnd), queryStatusKeyboardSelectionHandler, SRID.KeySelectToDocumentEnd, SRID.KeySelectToDocumentEndDisplayString);
}
示例10: _RegisterClassHandlers
//------------------------------------------------------
//
// Class Internal Methods
//
//------------------------------------------------------
#region Class Internal Methods
// Registers all text editing command handlers for a given control type
internal static void _RegisterClassHandlers(Type controlType, bool registerEventListeners)
{
var onTableCommand = new ExecutedRoutedEventHandler(OnTableCommand);
var onQueryStatusNYI = new CanExecuteRoutedEventHandler(OnQueryStatusNYI);
CommandHelpers.RegisterCommandHandler(controlType, EditingCommands.InsertTable , onTableCommand, onQueryStatusNYI, SRID.KeyInsertTable, SRID.KeyInsertTableDisplayString);
CommandHelpers.RegisterCommandHandler(controlType, EditingCommands.InsertRows , onTableCommand, onQueryStatusNYI, SRID.KeyInsertRows, SRID.KeyInsertRowsDisplayString);
CommandHelpers.RegisterCommandHandler(controlType, EditingCommands.InsertColumns , onTableCommand, onQueryStatusNYI, SRID.KeyInsertColumns, SRID.KeyInsertColumnsDisplayString);
CommandHelpers.RegisterCommandHandler(controlType, EditingCommands.DeleteRows , onTableCommand, onQueryStatusNYI, SRID.KeyDeleteRows, SRID.KeyDeleteRowsDisplayString);
CommandHelpers.RegisterCommandHandler(controlType, EditingCommands.DeleteColumns , onTableCommand, onQueryStatusNYI, SRID.KeyDeleteColumns, SRID.KeyDeleteColumnsDisplayString);
CommandHelpers.RegisterCommandHandler(controlType, EditingCommands.MergeCells , onTableCommand, onQueryStatusNYI, SRID.KeyMergeCells, SRID.KeyMergeCellsDisplayString);
CommandHelpers.RegisterCommandHandler(controlType, EditingCommands.SplitCell , onTableCommand, onQueryStatusNYI, SRID.KeySplitCell, SRID.KeySplitCellDisplayString);
}
示例11: RemovePreviewExecutedHandler
/// <summary>
/// Removes the handler from the element.
/// </summary>
/// <param name="element">The element from which to remove the handler.</param>
/// <param name="handler">The handler to remove.</param>
public static void RemovePreviewExecutedHandler(UIElement element, ExecutedRoutedEventHandler handler)
{
if (element == null)
{
throw new ArgumentNullException("element");
}
if (handler == null)
{
throw new ArgumentNullException("handler");
}
element.RemoveHandler(PreviewExecutedEvent, handler);
}
示例12: Bind
public virtual void Bind(ICommand command, ExecutedRoutedEventHandler executed, CanExecuteRoutedEventHandler canExecute)
{
if (View != null)
{
CommandBinding binding = new CommandBinding(command, executed, canExecute);
View.CommandBindings.Add(binding);
UnBind(command);
if (!_bindings.ContainsKey(command))
_bindings.Add(command, binding);
}
}
示例13: TableViewScrollViewer
public TableViewScrollViewer()
{
ExecutedRoutedEventHandler executedRoutedEventHandler = new ExecutedRoutedEventHandler( this.OnScrollCommand );
CanExecuteRoutedEventHandler canExecuteRoutedEventHandler = new CanExecuteRoutedEventHandler( this.OnQueryScrollCommand );
this.CommandBindings.Add(
new CommandBinding( ScrollBar.PageLeftCommand,
executedRoutedEventHandler,
canExecuteRoutedEventHandler ) );
this.CommandBindings.Add(
new CommandBinding( ScrollBar.PageRightCommand,
executedRoutedEventHandler,
canExecuteRoutedEventHandler ) );
}
示例14: RegisterCommandBindings
public RegisterCommandBindings(ICommand command, ExecutedRoutedEventHandler executed, CanExecuteRoutedEventHandler canExecute)
{
if (command == null)
{
throw new ArgumentNullException("command");
}
this._command = command;
if (executed != null)
{
this.Executed += executed;
}
if (canExecute != null)
{
this.CanExecute += canExecute;
}
}
示例15: AddBinding
static void AddBinding(ICommand command, ModifierKeys modifiers, Key key, ExecutedRoutedEventHandler handler)
{
CommandBindings.Add(new CommandBinding(command, handler));
InputBindings.Add(TextAreaDefaultInputHandler.CreateFrozenKeyBinding(command, modifiers, key));
}