Questions tagged [routed-commands]

WPF: Defines a command that implements ICommand and is routed through the element tree.

The WPF implementation of ICommand is the RoutedCommand class.

The main sources of input in WPF are the mouse, the keyboard, ink, and routed commands. The more device-oriented inputs use a RoutedEvent to notify objects in an application page that an input event has occurred. A RoutedCommand is no different. The Execute and CanExecute methods of a RoutedCommand do not contain the application logic for the command, but rather they raise routed events that tunnel and bubble through the element tree until they encounter an object with a CommandBinding. The CommandBinding contains the handlers for these events and it is the handlers that perform the command.

RoutedCommand Class

Commanding Overview

170 questions
2
votes
2 answers

RelayCommand vs EventToCommand

I'm little confused about RelayCommand and EventToCommand in Mvvmlight. It seems that EventToCommand handle the EventTrigger and call a RelayCommand to do job. Such as:
kidgu
  • 413
  • 1
  • 8
  • 18
2
votes
0 answers

WPF MediaCommands while program is running in background

I have a program where I've implemented some of the .NET Media Commands as Routed Commands in my MainWindow like this:
user1930728
  • 301
  • 1
  • 11
2
votes
1 answer

Unable to set CommandBinding inside Datatemplate

The following are two xaml snippets where the sole difference is that one example directly populates the window's visual tree and DataContext while the other contructs the same same window by applying data template. Visual Tree Content /…
Chris Kerekes
  • 1,116
  • 8
  • 27
2
votes
1 answer

How to execute the commands on remote Host using SSH from a web based application built in Django?

I have to execute some commands on a remote Host, this host will be a "Router". I have never ever done work with RPC calls. Another big problem is that i have to execute these commands from a Django web based Application. Steps are following: User…
Amit Pal
  • 10,604
  • 26
  • 80
  • 160
2
votes
1 answer

Can't add a routed command to a CheckBox in WPF

A custom RoutedCommand is used by some menuItems; I would like to use the same RoutedCommand with checkboxes : The compiler gives no error, but when i lauch the app, I get an exception…
rockeye
  • 2,765
  • 2
  • 30
  • 44
2
votes
1 answer

Programmatically wire event handler of a control in a datatemplate

I have clickable image/rectangle controls throughout my application and prefer to wire them in code: clickableimagecontrol.MouseUp += MouseUp_Handler I am struggling to understand how to do the same with datatemplates. I basically need to find the…
Jamona Mican
  • 1,574
  • 1
  • 23
  • 54
2
votes
1 answer

WPF prevent event bubbling outside of a control

Let's begin with the element tree. The topmost element is a WPF window which has registered ApplicationCommands.Find command. Some child elements have KeyBinding with the gesture key ENTER pointing at this command. That is OK, if someone presses…
theSpyCry
  • 12,073
  • 28
  • 96
  • 152
2
votes
0 answers

Is re-use of commands from the WPF command library a bad idea?

WPF provides a library of pre-defined commands (ApplicationCommands.Save, NavigationCommands.NextPage, etc.) that we can create command bindings for in our own application. I know that it is possible to create multiple command bindings for a single…
ebpa
  • 1,171
  • 1
  • 12
  • 31
1
vote
1 answer

Commands that act on two controls

Looking through the standard WPF commands, such as copy/paste, they seem to all work using one button and act on a textbox. My question: how do I use commands when I have one button, but I need data to be set in two separate controls(a textbox and a…
FZdev
  • 418
  • 1
  • 5
  • 10
1
vote
0 answers

Disabling CommandManager RequerySuggested Event

I want to test my project performance without using CommandManager RequerySuggested. I use the following codes to disable CommandManager from firing RequerySuggested Event. It removes all event handlers from RequerySuggested Event. Is there any…
hamid toosi
  • 95
  • 1
  • 10
1
vote
1 answer

WPF TextBox allow keybinding Undo to bubble

I'm handling key bindings in our application by allowing the key binding events to bubble up to the main window view where keybindings are defined in xaml and handled in the main window view model, e.g.,
James B
  • 8,975
  • 13
  • 45
  • 83
1
vote
1 answer

how to open specific section in window on button click in wpf c#

I want to open a window on button click from another window and go to specific tab in that window. Let's say new window (tabsWindow) has 3 tabs - tab1, tab2 and tab3 and I have 3 buttons on main window (buttonsWindow) btn1, btn2 and btn3. All three…
akilesh
  • 13
  • 4
1
vote
0 answers

Issue when using Routed Commands with a Frame

My WPF project has a main window with a number of buttons and a frame. I display a page within the frame, and the buttons above use routed commands in order to call methods present in the page below. With me so far? Everything works fine until I…
Jonathan
  • 13,947
  • 17
  • 94
  • 123
1
vote
1 answer

RoutedCommand in UserControl is not working as expected

I am trying to use RoutedCommands in my UserControls, following the example in this article: https://joshsmithonwpf.wordpress.com/2008/03/18/understanding-routed-commands/ I defined the RoutedCommand and CommandBindings in the UserControl instead of…
Vahid
  • 5,144
  • 13
  • 70
  • 146
1
vote
2 answers

WPF Application Command Bindings doesn't work

Hi I have a strange problem with CommandBindings in WPF. I add CommandBindings in constructor of object. The command bindings looks like that CommandBindings.Add(new CommandBinding(ApplicationCommands.Copy,Copy_Executed,Copy_Enabled)); …
losieko
  • 271
  • 3
  • 5