FreshMVVM access PageModel from Page code behind

MCvelMCvel USMember ✭✭✭

Hi all,

does anybody knows how to access the PageModel from the Page code behind?

I already tried using this: http://stackoverflow.com/questions/37917602/freshmvvm-access-pagemodel-from-page-code-behind?newreg=8426487c69544859ba861796ef300dfe

var pageModel = BindingContext as SamplePageModel;

however I always get my pageModel = null,

the thing is that I need to bind some TapGestureRecognizer to some methods/commands in my PageModel,

thank you all,

Tagged:

Best Answer

Answers

  • jbravobrjbravobr BRMember ✭✭
    edited July 2016

    Hi @MCvel,

    Is your VM inheriting from FreshBasePageModel ?

    Are you keep the FreshMvvm pattern for directories? As for Pages the directory name MUST BE Pages and for PageModels MUST BE PageModels ?

    Are you keep the FreshMvvm pattern for name of your View Models and Pages ? For Views Models MUST BE xptoPageModel and for Pages xptoPage.

    My guess is that the name pattern was not applied.

  • MCvelMCvel USMember ✭✭✭

    @jbravobr yes, the naming convention is properly configured, I actually have working some controls binded in XAML. Thanks!

    @RobHeckart that did the trick, thanks man!

Sign In or Register to comment.