Binding Commands to arbitrary handlers.

0 views
Skip to first unread message

Mike Brown

unread,
Jul 2, 2009, 1:45:57 PM7/2/09
to wpf-di...@googlegroups.com
 Guys here's some old cold that I meant to share with you that shows how to use the CommandBindingAdapter (checked into my WPF Toolbelt Project).
 
It also works if you were to use a binding to the DataContext as well. What do you think?

<Window.Resources>
   
<ObjectDataProvider ObjectType="{x:Type local:ContactTest}" x:Key="odp1"/>
   
<ObjectDataProvider ObjectType="{x:Type local:ObjectInvokerTest}" x:Key="odp2"/>
</Window.Resources>

<Util:CommandBindingAdapter.AttachCommand>
   
<Util:CommandBindingAdapter
       
Command="ApplicationCommands.Open"
       
Executed="{Util:ExecutedHandler Target={StaticResource odp2}, Handler=InvokeCommand}"/>
</Util:CommandBindingAdapter.AttachCommand>

Mike Brown

unread,
Jul 2, 2009, 1:46:16 PM7/2/09
to wpf-di...@googlegroups.com
Old code even :P
Reply all
Reply to author
Forward
0 new messages