WPF Routed COmmands.
Can some one explain me what is Routed Commands in WPF, with suitable example. When to use routed command and when to use ICommand.
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
Manikandan MurugesanPosted Jun 17, 2017, 9:52 AM
Pradeep YadavPosted Jun 19, 2017, 11:24 AM
Routed command can route (bubble/ tunnel) through the element hierarchy. Routed Command implements ICommand interface. It allows attaching input gestures like Mouse input and Keyboard shortcuts .Its source can be decoupled from target. WPF provides more than 100 built in command. These commands can be integrated to WPF controls which has command property like button, MenuItem, etc. EditingCommand, ComponentCommand, NavigationCommand, AplicationCommand are some of the classes which organise and expose built in commands.
You can create customized Routed commands by implementing ICommand.
You need to create static instance of type RoutedCommand. Then you need to implement _CanExecute and _Executed for the same.