September 2012
Intermediate to advanced
464 pages
10h 55m
English
A typical user control exposes properties and events, but it can also handle commands. These can be standard
commands (RoutedUICommands defined by WPF) or custom commands exposed as properties and invoked by the control. In this recipe, we'll see how to add command handling to a user control.
We'll use the projects we created in the previous recipe, Creating a user control, so make sure the solution is open.
We'll add handling for the standard MediaCommands.ChannelUp and MediaCommands.ChannelDown commands. ChannelUp will increase each of the RGB values and ChannelDown
will decrease them.
ColorPicker.xaml.cs. Add a static constructor to the class that registers for command ...