Skip to Main Content
Windows Presentation Foundation 4.5 Cookbook
book

Windows Presentation Foundation 4.5 Cookbook

by Pavel Yosifovich
September 2012
Intermediate to advanced content levelIntermediate to advanced
464 pages
10h 55m
English
Packt Publishing
Content preview from Windows Presentation Foundation 4.5 Cookbook

Using routed commands

WPF provides two (similar) implementations for the ICommand interface. Commands are invoked (by default) by command sources, implementing the ICommandSource interface. These two interfaces comprise the basic abstraction WPF recognizes as far as commands are concerned. In this recipe, we'll examine these interfaces, their out-of-the-box implementations, and how they are typically used.

Getting ready

Make sure Visual Studio is up and running.

How to do it...

We'll create a simple image viewer that provides its functionality via WPF routed commands:

  1. Create a new WPF application named CH07.RoutedCommands.
  2. Open MainWindow.xaml. Add the following to the existing Grid:
    <Grid.RowDefinitions> <RowDefinition Height="Auto" /> <RowDefinition ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Windows Presentation Foundation Development Cookbook

Windows Presentation Foundation Development Cookbook

Kunal Chowdhury

Publisher Resources

ISBN: 9781849686228Supplemental Content