I'm assuming your controller is bound to the control's datacontext? If so, I
normally expose properties that return the ICommand, and basically the
concrete implementation is a DelegateCommand (
http://msdn.microsoft.com/en-us/library/ff650631.aspx).

That's pretty much it.

On Sat, Jul 24, 2010 at 11:25 AM, Greg Keogh <[email protected]> wrote:

>  Folks, I’ve been searching for the correct way for a WPF control command
> (button click, list selection, etc) to run a method in the controller. I’m
> not using any official framework at the moment, I’m just experimenting with
> the raw techniques of ridding the control of code (as is the trend in MVVM
> these days). My controller class is defined like this in the XAML:
>
>
>
> <ctls:BaseWpfControl.Resources>
>
>        <ctls:FooController x:Key="controller"/>
>
> </ctls:BaseWpfControl.Resources>
>
>
>
> Note that I’m quite happy with the way my properties of the controller are
> bound to control properties in the classic way, so I have no problem with
> the controller-to-control direction. It’s the reverse that has me stumped.
> How can I get a control event to run a method in the controller?
>
>
>
> Web searches are voluminous and contradictory. Most recommend frameworks
> but various helper classes are available and some use attached properties.
> Can someone cut through all the noise for me and point me to the recommended
> way of doing this?
>
>
>
> I currently have code like this in the control and I want to get rid of it:
>
>
>
> controller = (NavigatorController)Resources["controller"];
>
> :
>
> // in button click event
>
> controller.DoThing();
>
>
>
> Cheers,
>
> Greg
>
> _______________________________________________
> ozwpf mailing list
> [email protected]
> http://prdlxvm0001.codify.net/mailman/listinfo/ozwpf
>
>
_______________________________________________
ozwpf mailing list
[email protected]
http://prdlxvm0001.codify.net/mailman/listinfo/ozwpf

Reply via email to