本文整理汇总了C#中System.Windows.Input.RoutedCommand类的典型用法代码示例。如果您正苦于以下问题:C# RoutedCommand类的具体用法?C# RoutedCommand怎么用?C# RoutedCommand使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
RoutedCommand类属于System.Windows.Input命名空间,在下文中一共展示了RoutedCommand类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: AutoCopyChanged
private static void AutoCopyChanged(DependencyObject obj, DependencyPropertyChangedEventArgs e_)
{
var listBox = obj as ListBox;
if (listBox != null)
{
if ((bool)e_.NewValue)
{
ExecutedRoutedEventHandler handler =
(sender, arg) =>
{
if (listBox.SelectedItems.Count > 0)
{
var sb = new StringBuilder();
foreach (var selectedItem in listBox.SelectedItems)
{
sb.AppendLine(selectedItem.ToString());
}
Clipboard.SetDataObject(sb.ToString());
}
};
var command = new RoutedCommand("Copy", typeof(ListBox));
command.InputGestures.Add(new KeyGesture(Key.C, ModifierKeys.Control, "Copy"));
listBox.CommandBindings.Add(new CommandBinding(command, handler));
}
}
}
开发者ID:ProjectTako,项目名称:HearthstoneTracker,代码行数:27,代码来源:ListBoxBehaviour.cs
示例2: Zoomer
static Zoomer()
{
Zoomer.ResetCommand = new RoutedCommand("Reset", typeof(Zoomer));
Zoomer.ZoomInCommand = new RoutedCommand("ZoomIn", typeof(Zoomer));
Zoomer.ZoomOutCommand = new RoutedCommand("ZoomOut", typeof(Zoomer));
Zoomer.PanLeftCommand = new RoutedCommand("PanLeft", typeof(Zoomer));
Zoomer.PanRightCommand = new RoutedCommand("PanRight", typeof(Zoomer));
Zoomer.PanUpCommand = new RoutedCommand("PanUp", typeof(Zoomer));
Zoomer.PanDownCommand = new RoutedCommand("PanDown", typeof(Zoomer));
Zoomer.SwitchTo2DCommand = new RoutedCommand("SwitchTo2D", typeof(Zoomer));
Zoomer.SwitchTo3DCommand = new RoutedCommand("SwitchTo3D", typeof(Zoomer));
Zoomer.ResetCommand.InputGestures.Add(new MouseGesture(MouseAction.LeftDoubleClick));
Zoomer.ResetCommand.InputGestures.Add(new KeyGesture(Key.F5));
Zoomer.ZoomInCommand.InputGestures.Add(new KeyGesture(Key.OemPlus));
Zoomer.ZoomInCommand.InputGestures.Add(new KeyGesture(Key.Up, ModifierKeys.Control));
Zoomer.ZoomOutCommand.InputGestures.Add(new KeyGesture(Key.OemMinus));
Zoomer.ZoomOutCommand.InputGestures.Add(new KeyGesture(Key.Down, ModifierKeys.Control));
Zoomer.PanLeftCommand.InputGestures.Add(new KeyGesture(Key.Left));
Zoomer.PanRightCommand.InputGestures.Add(new KeyGesture(Key.Right));
Zoomer.PanUpCommand.InputGestures.Add(new KeyGesture(Key.Up));
Zoomer.PanDownCommand.InputGestures.Add(new KeyGesture(Key.Down));
Zoomer.SwitchTo2DCommand.InputGestures.Add(new KeyGesture(Key.F2));
Zoomer.SwitchTo3DCommand.InputGestures.Add(new KeyGesture(Key.F3));
}
开发者ID:noamkfir,项目名称:snoopwpf,代码行数:25,代码来源:Zoomer.xaml.cs
示例3: MainViewContent
public MainViewContent(string fileName, IWorkbenchWindow workbenchWindow)
{
codeEditor = new CodeEditor();
textEditor = new TextEditor();
textEditor.FontFamily = new FontFamily("Consolas");
textEditor.TextArea.TextEntering += TextAreaOnTextEntering;
textEditor.TextArea.TextEntered += TextAreaOnTextEntered;
textEditor.ShowLineNumbers = true;
var ctrlSpace = new RoutedCommand();
ctrlSpace.InputGestures.Add(new KeyGesture(Key.Space, ModifierKeys.Control));
var cb = new CommandBinding(ctrlSpace, OnCtrlSpaceCommand);
// this.CommandBindings.Add(cb);
adapter = new SharpSnippetTextEditorAdapter(textEditor);
this.WorkbenchWindow = workbenchWindow;
textEditor.TextArea.TextView.Services.AddService(typeof (ITextEditor), adapter);
LoadFile(fileName);
iconBarManager = new IconBarManager();
textEditor.TextArea.LeftMargins.Insert(0, new IconBarMargin(iconBarManager));
var textMarkerService = new TextMarkerService(textEditor.Document);
textEditor.TextArea.TextView.BackgroundRenderers.Add(textMarkerService);
textEditor.TextArea.TextView.LineTransformers.Add(textMarkerService);
textEditor.TextArea.TextView.Services.AddService(typeof (ITextMarkerService), textMarkerService);
textEditor.TextArea.TextView.Services.AddService(typeof (IBookmarkMargin), iconBarManager);
}
开发者ID:sentientpc,项目名称:SharpSnippetCompiler-v5,代码行数:30,代码来源:MainViewContent.cs
示例4: CreateHyperLink
/// <summary>
/// Tworzy linka i ustawia jego właściwości
/// </summary>
/// <param name="linkText"></param>
/// <param name="linkAdress"></param>
/// <param name="toolTip"></param>
/// <returns></returns>
private static Hyperlink CreateHyperLink(string linkText, string linkAdress, string toolTip, FontWeight weight,
Brush linkColor, RoutedCommand command)
{
System.Windows.Controls.ToolTip tip = new ToolTip();
tip.Content = toolTip;
tip.StaysOpen = true;
tip.Style = (Style) Application.Current.FindResource("YellowToolTipStyle");
Hyperlink hyperlink = new Hyperlink(new Run(linkText))
{
NavigateUri = new Uri(linkAdress),
TextDecorations = null,
FontWeight = weight,
//FontWeights.SemiBold,
Foreground = linkColor,
ToolTip = tip
};
hyperlink.Command = command;
hyperlink.CommandParameter = linkAdress;
ToolTipService.SetInitialShowDelay(hyperlink,700);
ToolTipService.SetShowDuration(hyperlink,15000);
//hyperlink.AddHandler(Hyperlink.RequestNavigateEvent,
// new RequestNavigateEventHandler(HyperLinkRequestNavigate));
return hyperlink;
}
开发者ID:ksopyla,项目名称:blipface,代码行数:36,代码来源:StatusBindableTextBlock.cs
示例5: PrologDebugCommands
static PrologDebugCommands()
{
m_addBreakpoint = new RoutedCommand();
m_clearAllBreakpoints = new RoutedCommand();
m_clearBreakpoint = new RoutedCommand();
m_endProgram = new RoutedCommand();
m_restart = new RoutedCommand();
m_restart.InputGestures.Add(new KeyGesture(Key.F5, ModifierKeys.Control | ModifierKeys.Shift));
m_runToBacktrack = new RoutedCommand();
m_runToBacktrack.InputGestures.Add(new KeyGesture(Key.F6));
m_runToSuccess = new RoutedCommand();
m_runToSuccess.InputGestures.Add(new KeyGesture(Key.F5));
m_stepIn = new RoutedCommand();
m_stepIn.InputGestures.Add(new KeyGesture(Key.F11));
m_stepOut = new RoutedCommand();
m_stepOut.InputGestures.Add(new KeyGesture(Key.F11, ModifierKeys.Shift));
m_stepOver = new RoutedCommand();
m_stepOver.InputGestures.Add(new KeyGesture(Key.F10));
m_toggleBreakpoint = new RoutedCommand();
}
开发者ID:wallymathieu,项目名称:Prolog.NET,代码行数:30,代码来源:PrologDebugCommands.cs
示例6: ColorViewModel
public ColorViewModel(FrameworkElement window)
{
Window = window;
cmdShow = new RoutedCommand();
CommandManager.RegisterClassCommandBinding(Window.GetType(), new CommandBinding(cmdShow, cmdShow_Click));
FillColors();
}
开发者ID:kovtunenkoa,项目名称:Colorer,代码行数:7,代码来源:ColorViewModel.cs
示例7: 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;
}
开发者ID:lucaslra,项目名称:SPM,代码行数:7,代码来源:CommandBindingCollectionExtensions.cs
示例8: WidgetElement
/// <summary>
/// Initializes the <see cref="WidgetElement"/> class.
/// </summary>
static WidgetElement()
{
WidgetElement.DefaultStyleKeyProperty.OverrideMetadata(typeof(WidgetElement),
new FrameworkPropertyMetadata(typeof(WidgetElement)));
WidgetElement.MinimizeCommand = new RoutedCommand("Minimize", typeof(WidgetElement));
Control.IsTabStopProperty.OverrideMetadata(typeof(WidgetElement),
new FrameworkPropertyMetadata(false));
KeyboardNavigation.DirectionalNavigationProperty.OverrideMetadata(
typeof(WidgetElement), new FrameworkPropertyMetadata(KeyboardNavigationMode.Cycle));
KeyboardNavigation.TabNavigationProperty.OverrideMetadata(
typeof(WidgetElement), new FrameworkPropertyMetadata(KeyboardNavigationMode.Cycle));
KeyboardNavigation.ControlTabNavigationProperty.OverrideMetadata(
typeof(WidgetElement), new FrameworkPropertyMetadata(KeyboardNavigationMode.Once));
if (!DesignMode.IsInDesignMode
&& Application.Current.GetRenderTier() != RenderTier.Tier2)
{
WidgetElement.CacheModeProperty.OverrideMetadata(typeof(WidgetElement),
new FrameworkPropertyMetadata(new BitmapCache { EnableClearType = true, RenderAtScale = 1, SnapsToDevicePixels = true }));
}
}
开发者ID:cipjota,项目名称:Chronos,代码行数:29,代码来源:WidgetElement.cs
示例9: CrudCC
static CrudCC()
{
DefaultStyleKeyProperty.OverrideMetadata(typeof(CrudCC), new FrameworkPropertyMetadata(typeof(CrudCC)));
FilterProperty = DependencyProperty.Register("Filter", typeof(ContentControl), typeof(CrudCC), new FrameworkPropertyMetadata(null, FrameworkPropertyMetadataOptions.Inherits));
FormEditProperty = DependencyProperty.Register("FormEdit", typeof(ContentControl), typeof(CrudCC), new UIPropertyMetadata(null));
FormNewProperty = DependencyProperty.Register("FormNew", typeof(ContentControl), typeof(CrudCC), new UIPropertyMetadata(null));
DataViewProviderProperty = DependencyProperty.Register("DataViewProvider", typeof(Type), typeof(CrudCC), new UIPropertyMetadata(typeof(object), OnChangeDataViewProvider));
IsBindableProperty = DependencyProperty.Register("IsBindable", typeof(bool), typeof(CrudCC), new UIPropertyMetadata(true, null, OnCoerceIsBindable));
FilterBlockWidthProperty = DependencyProperty.Register("FilterBlockWidth", typeof(double), typeof(CrudCC), new UIPropertyMetadata(0.0));
FilterBlockHeightProperty = DependencyProperty.Register("FilterBlockHeight", typeof(double), typeof(CrudCC), new UIPropertyMetadata(0.0));
FormEditBlockWidthProperty = DependencyProperty.Register("FormEditBlockWidth", typeof(double), typeof(CrudCC), new UIPropertyMetadata(0.0, OnFormEditBlockWidthChanged));
FormEditBlockHeightProperty = DependencyProperty.Register("FormEditBlockHeight", typeof(double), typeof(CrudCC), new UIPropertyMetadata(0.0, OnFormEditBlockHeightChanged));
FormNewBlockWidthProperty = DependencyProperty.Register("FormNewBlockWidth", typeof(double), typeof(CrudCC), new UIPropertyMetadata(0.0, null, OnCoerceFormNewBlockWidth));
FormNewBlockHeightProperty = DependencyProperty.Register("FormNewBlockHeight", typeof(double), typeof(CrudCC), new UIPropertyMetadata(0.0, null, OnCoerceFormNewBlockHeight));
MoveFirstAction = new RoutedCommand("MoveFirstAction", typeof(CrudCC));
MoveBackwardAction = new RoutedCommand("MoveBackwardAction", typeof(CrudCC));
MoveForwardAction = new RoutedCommand("MoveForwardAction", typeof(CrudCC));
MoveLastAction = new RoutedCommand("MoveLastAction", typeof(CrudCC));
ToggleFilterAction = new RoutedCommand("ToggleFilterAction", typeof(CrudCC));
ToggleFormAction = new RoutedCommand("ToggleFormAction", typeof(CrudCC));
NewRowAction = new RoutedCommand("NewRowAction", typeof(CrudCC));
DeleteAction = new RoutedCommand("DeleteAction", typeof(CrudCC));
}
开发者ID:koder05,项目名称:fogel-ba,代码行数:27,代码来源:CrudCC.cs
示例10: DockCommands
static DockCommands()
{
CloseDockPane = new RoutedCommand("CloseDockPane", typeof(DockCommands));
CloseFloatForm = new RoutedCommand("CloseFloatForm", typeof(DockCommands));
HideDockPane = new RoutedCommand("HideDockPane", typeof(DockCommands));
PurgeAndAttachMouse = new RoutedCommand("PurgeAndAttachMouse", typeof(DockCommands));
}
开发者ID:namoshika,项目名称:SnkLib.Win.WPF.DockingWindow,代码行数:7,代码来源:DockCommands.cs
示例11: Bind
public static RoutedCommand Bind(UIElement target, RoutedCommand command)
{
target.CommandBindings.AddCommandExecutedHandler(command, Execute );
target.CommandBindings.AddCommandCanExecuteHandler(command, CanExecute);
return command;
}
开发者ID:lucaslra,项目名称:SPM,代码行数:7,代码来源:MessengerBinding.cs
示例12: page_chat
public page_chat()
{
InitializeComponent();
RoutedCommand Input_SendMessage = new RoutedCommand();
RoutedCommand Input_Return = new RoutedCommand();
KeyBinding Input_SendMessage_Keybinding = new KeyBinding(Input_SendMessage, new KeyGesture(Key.Enter));
CommandBinding Input_SendMessage_Binding = new CommandBinding(Input_SendMessage, Input_SentMessage_Execute, CmdCanExecute);
KeyBinding Input_Return_Keybinding = new KeyBinding(Input_Return, new KeyGesture(Key.Enter, ModifierKeys.Control));
CommandBinding Input_Return_Binding = new CommandBinding(Input_Return, Input_Return_Execute, CmdCanExecute);
this.rtf_input.InputBindings.Add(Input_SendMessage_Keybinding);
this.rtf_input.CommandBindings.Add(Input_SendMessage_Binding);
this.rtf_input.InputBindings.Add(Input_Return_Keybinding);
this.rtf_input.CommandBindings.Add(Input_Return_Binding);
CommandBinding pasteCmdBinding = new CommandBinding(ApplicationCommands.Paste, OnPaste, OnCanExecutePaste);
this.rtf_input.CommandBindings.Add(pasteCmdBinding);
try
{
this.rtf_input.FontSize = Convert.ToDouble(ConfigManager.Instance.GetString("font_size", "12"));
this.rtf_input.FontFamily = new FontFamily(ConfigManager.Instance.GetString("font", "Segoe WP"));
this.rtf_input.Foreground = (SolidColorBrush)new BrushConverter().ConvertFromString(ConfigManager.Instance.GetString("font_color", "#000000"));
}
catch { }
this.rtf_input.AddHandler(RichTextBox.DragOverEvent, new DragEventHandler(rtf_DragOver), true);
this.rtf_input.AddHandler(RichTextBox.DropEvent, new DragEventHandler(rtf_DragDrop), true);
}
开发者ID:astorks,项目名称:BlazeIM,代码行数:33,代码来源:page_chat.xaml.cs
示例13: 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);
}
开发者ID:sjyanxin,项目名称:WPFSource,代码行数:7,代码来源:CommandHelpers.cs
示例14: CustomCommands
static CustomCommands()
{
exitCommand = new RoutedCommand("Exit", typeof(CustomCommands));
aboutCommand = new RoutedCommand("About", typeof(CustomCommands));
editDeleteCommand = new RoutedCommand("EditDelete", typeof(CustomCommands));
editRenameCommand = new RoutedCommand("EditRename", typeof(CustomCommands));
settingsCommand = new RoutedCommand("Settings", typeof(CustomCommands));
preferencesCommand = new RoutedCommand("Preferences", typeof(CustomCommands));
selectCommand = new RoutedCommand("Select", typeof(CustomCommands));
moveCommand = new RoutedCommand("Move", typeof(CustomCommands));
rotateCommand = new RoutedCommand("Rotate", typeof(CustomCommands));
scaleCommand = new RoutedCommand("Scale", typeof(CustomCommands));
camModeSolidCommand = new RoutedCommand("CamModeSolid", typeof(CustomCommands));
camModeWireframeCommand = new RoutedCommand("CamModeWireframe", typeof(CustomCommands));
camModePointsCommand = new RoutedCommand("CamModePoints", typeof(CustomCommands));
clearLogCommand = new RoutedCommand("ClearLog", typeof(CustomCommands));
toggleRenderCommand = new RoutedCommand("ToggleRender", typeof(CustomCommands));
toggleSceneCommand = new RoutedCommand("ToggleScene", typeof(CustomCommands));
toggleObjectsCommand = new RoutedCommand("ToggleObjects", typeof(CustomCommands));
toggleEntityCommand = new RoutedCommand("ToggleEntity", typeof(CustomCommands));
togglePropertiesCommand = new RoutedCommand("ToggleProperties", typeof(CustomCommands));
toggleLogCommand = new RoutedCommand("ToggleLog", typeof(CustomCommands));
toggleMaterialsCommand = new RoutedCommand("ToggleMaterials", typeof(CustomCommands));
toggleTemplatesCommand = new RoutedCommand("ToggleTemplates", typeof(CustomCommands));
}
开发者ID:andyhebear,项目名称:likeleon,代码行数:25,代码来源:CustomCommands.cs
示例15: AutoCopyChanged
private static void AutoCopyChanged(DependencyObject obj_, DependencyPropertyChangedEventArgs e_)
{
var listBox = obj_ as ListBox;
if (listBox != null)
{
if ((bool)e_.NewValue)
{
ExecutedRoutedEventHandler handler =
(sender_, arg_) =>
{
if (listBox.SelectedItems.Count > 0)
{
string copyContent = string.Empty;
foreach (var item in listBox.SelectedItems)
copyContent += item.ToString() + Environment.NewLine;
Clipboard.SetText(copyContent);
}
};
var command = new RoutedCommand("Copy", typeof(ListBox));
command.InputGestures.Add(new KeyGesture(Key.C, ModifierKeys.Control, "Copy"));
listBox.CommandBindings.Add(new CommandBinding(command, handler));
}
}
}
开发者ID:628426,项目名称:Strive.NET,代码行数:25,代码来源:ListBoxBehavior.cs
示例16: SetupKeyboardShortcuts
private void SetupKeyboardShortcuts() {
// esc -- close the window
var close = new RoutedCommand();
close.InputGestures.Add( new KeyGesture( Key.Escape ) );
CommandBindings.Add( new CommandBinding( close, this.CloseWindow ) );
}
开发者ID:AIBrain,项目名称:gold_mine,代码行数:7,代码来源:statistics.xaml.cs
示例17: SimpleRoutedCommand
public SimpleRoutedCommand(string text)
{
RoutedUICommand routedCommand = new RoutedUICommand();
routedCommand.Text = text;
_routedCommand = routedCommand;
init();
}
开发者ID:Choi-Insu,项目名称:arrengers,代码行数:7,代码来源:SimpleRoutedCommand.cs
示例18: MainWindow
public MainWindow()
{
InitializeComponent();
Items = new ObservableCollection<string>();
AddFilesCommand = new RoutedCommand(
"AddFilesCommand",
GetType(),
new InputGestureCollection(
new [] { new KeyGesture(Key.O, ModifierKeys.Control) }
)
);
GenerateCommand = new RoutedCommand(
"GenerateCommand",
GetType(),
new InputGestureCollection(
new [] { new KeyGesture(Key.S, ModifierKeys.Control) }
)
);
DeleteCommand = new RoutedCommand(
"DeleteCommand",
GetType(),
new InputGestureCollection(
new[] { new KeyGesture(Key.Delete) }
)
);
CommandBindings.Add(new CommandBinding(AddFilesCommand, AddFilesCommand_Executed));
CommandBindings.Add(new CommandBinding(GenerateCommand, GenerateCommand_Executed, GenerateCommand_CanExecute));
CommandBindings.Add(new CommandBinding(DeleteCommand, DeleteCommand_Executed, DeleteCommand_CanExecute));
DataContext = this;
}
开发者ID:impworks,项目名称:xna.geek.engine,代码行数:35,代码来源:MainWindow.xaml.cs
示例19: CageCommands
static CageCommands()
{
CommandFeedClick = new RoutedCommand("CommandFeedClick", typeof(CageCommands));
CommandHealClick = new RoutedCommand("CommandHealClick", typeof(CageCommands));
CommandGrowClick = new RoutedCommand("CommandGrowClick", typeof(CageCommands));
CommandBinding bindingfeed = new CommandBinding();
bindingfeed.Command = CommandFeedClick;
bindingfeed.Executed += new ExecutedRoutedEventHandler(CommandFeedClick_Executed);
bindingfeed.CanExecute += new CanExecuteRoutedEventHandler(CommandFeedClick_CanExecute);
CommandBinding bindingheal = new CommandBinding();
bindingheal.Command = CommandHealClick;
bindingheal.Executed += new ExecutedRoutedEventHandler(CommandHealClick_Executed);
bindingheal.CanExecute += new CanExecuteRoutedEventHandler(CommandHealClick_CanExecute);
CommandBinding bindinggrow = new CommandBinding();
bindinggrow.Command = CommandGrowClick;
bindinggrow.Executed += new ExecutedRoutedEventHandler(CommandGrowClick_Executed);
bindinggrow.CanExecute += new CanExecuteRoutedEventHandler(CommandGrowClick_CanExecute);
CommandManager.RegisterClassCommandBinding(typeof(CageControl), bindingfeed);
CommandManager.RegisterClassCommandBinding(typeof(CageControl), bindingheal);
CommandManager.RegisterClassCommandBinding(typeof(CageControl), bindinggrow);
}
开发者ID:kbo4sho,项目名称:ZooKeeperWpf,代码行数:25,代码来源:CageCommands.cs
示例20: MainWindow
public MainWindow()
{
InitializeComponent();
FullScreenCommand = new RoutedCommand("FullScreenCommand", typeof(MainWindow));
FullScreenCommandBinding = new CommandBinding(FullScreenCommand, FullScreenCommandHandler);
}
开发者ID:xp880906,项目名称:MangaViewer,代码行数:7,代码来源:MainWindow.xaml.cs
注:本文中的System.Windows.Input.RoutedCommand类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论