1

Resolved

Behaviour EventCommander don't work in Metro

description

I was attaching to page's load event and it throws page not loaded exception when trying to create main page in app.vb. i tryed another helper "metroEventToCommand" and it works. So the problem not in my code.

comments

mity wrote May 5, 2013 at 10:09 PM

In CommandEvent class there is a typo in GetEventMethod the line MethodInfo methodInfo = typeof(CommandEvent).GetTypeInfo().DeclaredMethods.FirstOrDefault( mi => mi.Name == "OnEventRaised" && mi.IsPrivate && !mi.IsStatic);

and it was. Which is wrong. As EventCommand dont have OnEventRaised
            MethodInfo methodInfo = typeof(EventCommand).GetTypeInfo().DeclaredMethods.FirstOrDefault(                        mi => mi.Name == "OnEventRaised" && mi.IsPrivate && !mi.IsStatic);

markjulmar wrote May 6, 2013 at 3:55 PM

Make sure to pull the latest trunk - I'm looking at

http://mvvmhelpers.codeplex.com/SourceControl/changeset/view/83495#1747554

which has the specific method.

Mark Smith

mark@julmar.com | @marksm | 214-774-4749 |www.julmar.com/blog/mark

mity wrote May 6, 2013 at 4:56 PM

Checked with the link you provided. Inside typeof(.....) you have EventCommand but it shoud be CommandEvent . EventCommand don't have OnEventRaised method.

mity wrote May 6, 2013 at 5:02 PM

Sorry inside typeof() you have EventCommander, but only CommandEvent class has OnEventRaised method. EventCommander class has all kind of mapping staff.

markjulmar wrote May 6, 2013 at 5:25 PM

Interesting - let me look into it, thanks for the clarification!

markjulmar wrote May 6, 2013 at 5:29 PM

I always use EventTrigger these days and didn't catch this; I'll fix it ASAP and add a test for it. Thanks for letting me know.

mark

markjulmar wrote May 6, 2013 at 5:43 PM

Fixed in 1.08 on Nuget and CodePlex.