| 
  • If you are citizen of an European Union member nation, you may not use this service unless you are at least 16 years old.

  • You already know Dokkio is an AI-powered assistant to organize & manage your digital files & messages. Very soon, Dokkio will support Outlook as well as One Drive. Check it out today!

View
 

WPF

Page history last edited by Corey Alix 14 years, 7 months ago

External Links

http://msdn.microsoft.com/en-us/library/ms748948.aspx - WPF Overview

http://msdn.microsoft.com/en-us/library/bb909794.aspx - WPF Add-ins Overview

http://msdn.microsoft.com/en-us/library/ms746927.aspx - WPF Fundamentals

http://www.switchonthecode.com/frameworks/dotnet - Tutorials, etc 

http://www.switchonthecode.com/languages/xaml - Tutorials, etc

http://bea.stollnitz.com/blog/?page_id=47 - Table of contents to Bea Stollnitz WPF blog.

 

Application Frameworks

 

TODO

 

 

Fundamental Elements of WPF

 

Commands

Commanding Overview

http://msdn.microsoft.com/en-us/library/ms752308.aspx

  • commands separate the semantics and the originator of an action from its logic
  • allows the command logic to be customized for different targets
  • The command is the action to be executed.
  • The command source is the object which invokes the command (e.g. MenuItem, Button, and KeyGesture)
  • The command target is the object that the command is being executed on.
  • The command binding is the object which maps the command logic to the command.
  • The implementation logic is the responsibility of the object on which the command is being executed on
  • The command source can explicitly set the command target
  • The InvalidateRequerySuggested method forces the CommandManager to raise the RequerySuggested event
  • Related Topics - ApplicationCommands, KeyGesture, MouseGesture, KeyBinding
Command Pattern

http://www.codeproject.com/KB/WPF/WpfCommandPatternApplied.aspx

To use the command system, the following approach is suggested:

  1. Design and implement the command class hierarchy
  2. Design and implement the command unit tests
  3. Create a CommandCollection: static binding of each command with a CommandDescription
  4. Embed button image resources
  5. Add Command references in XAML
  6. Configure the tooltip format upon application start
  7. Setup the CommandRepository at application start: CommandRepository.AddRange()
  8. Setup the CommandBinding in the application window: CommandBindings.AddRange(CommandRepository.Bindings )

 

With this framework the implementation logic is the responsibility of the command being executed -- MSDN states, "implementation logic is the responsibility of the object on which the command is being executed."  Is this a problem?

Intro to WPF Command Framework

http://www.devx.com/DevX/Article/37893/0/page/2

Sample with two ListBox.CommandBindings binding to the same command

  • WPF commands don't implement command behavior
  • WPF commands merely notify UI elements that a command has been invoked
  • The UI elements must implement any desired behavior

http://www.devx.com/DevX/Article/37893/0/page/3

Sample custom command (InsertCustomer)

Smart Routed Commands

http://www.codeproject.com/KB/WPF/SmartRoutedCommandsInWPF.aspx

  • Paradoxically, routed commands are very useful because they don't do anything
  • standard execution logic should be used as a fallback plan if the routed command was not handled by any element in the tree
  • the RoutedCommand class does not expose any virtual methods that we can override to specify our default execution logic
  • Implements SmartRoutedCommand: RoutedCommand w/ IsCommandSync dependency property, Can/ExecuteCore methods.
  • This technique is like having the root of the element tree forward our command a notification that it is being used but nobody knows what to do, so that we can then use the subclass's default logic

 

The dependency property allows for marking a "root" element -- probably a window:

<Window x:Class="SmartRoutedCommandDemo.Window1" ... local:SmartRoutedCommand.IsCommandSink="True" >

In this example the default logic executes if nobody CanExecute the command.

 

NOTE: The window IsCommandSink for all instances of SmartRoutedCommand.  What if I only want this for specific commands?

 

 

 

Data Binding and Templating

Data Templating Overview

http://msdn.microsoft.com/en-us/library/ms742521.aspx

[Notes]

   

 

 

[Functional Area]

[Title]

[URL]

[Notes]

   

 

 

[Functional Area]

[Title]

[URL]

[Notes]

   

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Books

Programming WPF by Chris Sells and Ian Griffiths

Safari Books Online service $30/month

 

Internationalization * Globalization * Localization 

Found a nice WPF Tutorial with code for light-weight localization.

 

Things to Do

  • Data Template
  • Control Template
  • Styles
  • Data Binding
  • Input Bindings

 

Comments (0)

You don't have permission to comment on this page.