This project is read-only.

missing attribute 'PassEventArgsToCommand'

Nov 19, 2012 at 1:55 AM


I was missing the Attribute


in the


when I ported my app from WP7 to WinRT.



 <Triggers:EventTrigger EventName ="Tapped">


<Triggers:InvokeCommandAction Command="{Binding ExtenderTap }"

 PassEventArgsToCommand ="true">









So I extended your lib. What should I do, that my code will be included?





Dec 13, 2012 at 2:31 PM

Hi Hanno - Really sorry, I've only just seen this post.

That sounds like it would be a great addition - if you're still interested you could:

  • Attempt to submit a patch here - I've not got any experience actually generating patches, so can't offer much help beyond that at the moment.
  • Send me the changes via email (you can contact me via my profile) and I'll get them integrated.



Dec 13, 2012 at 2:32 PM
This discussion has been copied to a work item. Click here to go to the work item and continue the discussion.
Dec 24, 2012 at 3:56 PM
for some time, I did other things, so the delay. In the meantime I
changed a litte more, mainly to fit my personal formatting styles.
Still intereessted for my changes?

Jan 2, 2013 at 10:03 PM

No worries - if you've diverged quite a lot from the original codebase it might be easier if I implement myself.

Is it code formatting changes you've made or the way the runtime XAML is structured?


Jan 21, 2013 at 5:30 PM

Hi  there,

did you get anywhere with PassEventArgsToCommand, as that would be really handy. 



Jan 21, 2013 at 10:04 PM

I just uploaded my code, but ist still under developent




Jan 22, 2013 at 11:33 AM

yep, that does the trick

one problem I ran into was that it was returning EventArgs to my ViewModel, which sits in a layer below the UI.

To get round that, I've built an extension that works in a similar fashion, but uses CommandParameter for the name of the property of the EventArgs to pass back - in my case, I just need the Uri from NavigationEventArgs


        protected override void DoInvoke(object e)
            var command = Command;
            if (command != null && command.CanExecute(CommandParameter))
                command.Execute(CommandParameter != null && PassEventArgValueToCommand ? e.GetPropertyValue(CommandParameter.ToString()) : CommandParameter);


of course, reflection in WinRT isn't what it used to be, so I used for the extension method GetPropertyValue(this Object instance, string propertyValue)

I'll have a go at submitting a patch, but this isn't the best code I've written (especially using CommandParameter, that's the wrong name), so I'm happy for it to be mauled about. That's the important bit right up above


cheers, this has really helped me out


Jan 22, 2013 at 10:40 PM

Thanks for the patches folks - it makes such a difference knowing that people actually use this stuff and are willing to give back!

@riotgibbon - I haven't folded your changes in yet because I want to understand a bit more about your scenario. From your description I take it that your view model is in a separate assembly that doesn't have a reference to the Windows assemblies, which means you can't extract the information you need from events like TappedRoutedEventArgs. Are there specific events that you're trying to feed up the layers? Can you give an example of the XAML where you're using it?



Jan 23, 2013 at 12:12 PM

Hi Mike,

the library has come in really handy, thanks for putting it up

OK, so my specific use case is a WinRT/WP8 app, using MVVMCross to manage the ViewModels. I need to authenticate via Facebook, which is all done through a WebView control. You navigate to a URL based on your appId (I'm using the Facebook SDK), they do their secret password login thing, and the WebView will then get redirected to a URI, which then has the oauthtoken you can then use for getting more details, that sort of thing

What we need do is then capture the LoadCompleted event, get the uri from the NavigationEventArgs, then pass that down to the ViewModel for appropriate processing

So, in WinRT xaml:


<WebView  x:Name="FacebookLoginView"  Source="{Binding LoginUrl, Mode=OneTime}"  Margin="200,100,200,200" Height="450" >
        <Triggers:EventTrigger EventName="LoadCompleted" >
            <localTriggers:InvokeCommandWithEventArgAction Command="{Binding ReturnedData}" CommandParameter="Uri" PassEventArgValueToCommand="True"  />



I've a command called ReturnedData - need to refactor, that passes the Uri to a ProcessResponseUri method. My patch takes the property specified in the CommandParameter:

        public  ICommand ReturnedData
                return new MvxRelayCommand<Uri>(async uri =>
                        await ProcessResponseUri(uri);

                    }); }

All nicely setup in the xaml


Interestingly, when it came to the Phone8 version, I realised I'd painted myself into a corner with the WinRT version, and slipped in a bit of code behind:

            FacebookLoginView.LoadCompleted += async (sender, navigationEventArgs) =>
                await this.ViewModel.ProcessResponseUri(navigationEventArgs.Uri);

which is code I'd "written" whilst asleep between my initial request and picking up Hanno's patch on Tuesday morning


so that's the context, I'm not really expecting you to integrate, but I've found it useful







Jan 30, 2013 at 11:31 PM
Thanks for that, Toby.

I'll keep it out of this release because I want to spend a little more time thinking about it, but the PassEventArgsToCommand code is now available in the latest release, so you should be able to build your implementation from there if you need to.