Passing in Subproperty of DataContext as a parameter

Topics: Actions & Coroutines
Dec 2, 2011 at 3:18 PM

I have two Hyperlinks on my view which I currently have wired to the same command and bind the command parameter to a different screen per link. The links change the ActiveItem of my conductor. I would like to change my approach from using commands to using Actions as I want to invoke a Coroutine on the clicking of the link. The problem I have is that I would like to pass in $dataContext.ScreenA and $dataContext.ScreenB as the parameters for my Coroutine, but this doesn't seem supported. So I have 2 questions.

1) Do you have any guidance on how to add such behavior to the Parser

2) Is there a simple way to kick off a Coroutine from a Command since I need the ActionExecutionContext and want to avoid building the code from

Note: I know in this case I can use the extended syntax (using System.Windows.Interactivity) to kick off my action, but it would be great to support this out the box (or at least in my organizations customizations/conventions).

Dec 4, 2011 at 5:44 PM

does the action in your xaml, have to contain only 1 parameter?  I have done it in the past to pass more than one param in the method signature in the xaml code.  As long as the signature matches what is in the XAML it will be found and used.

<Hyperlink Content="Screen A" cal:Message.Attach="[Event Click] = [Action SomeMethod('ScreenA', $dataContext)]" />

public void SomeMethod(string screen, object context){




Dec 4, 2011 at 9:33 PM

Regarding your first question, you have to "override" MessageBinder.EvaluateParameter to actually evaluate the dot expression. I did this in my contrib project at github. have a look at (line 144 and 230) if you want to know how i did it. I use the Dynamic Extension from MS to evaluate the expression. This works for WPF and SL

Cant help you with your second question though because i dont understand the problem :/