Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Using Gestures on SlideMenuView - how to close #1

Closed
stefandevo opened this issue Apr 19, 2016 · 5 comments
Closed

Using Gestures on SlideMenuView - how to close #1

stefandevo opened this issue Apr 19, 2016 · 5 comments

Comments

@stefandevo
Copy link

Hi, great component! Thanks for open sourcing it.

Your samples show a SlideMenuView with image/label combinations that would present buttons in real life. I added a gesture recogniser on the StackLayouts to catch a command. Although this works perfectly I would need a way to close the SlideMenuView afterwards.... Any suggestion on doing this. I now have a command that binds with my view model + a tapped event handler for all these panels that do a HideWithoutAnimations(). Is this the way to do it?

Btw: I using this on Android (AppCompat).

@jessejiang0214
Copy link
Contributor

I have a suggestion, which I often used in my projects.
In you ViewModel, you can set a Action property like

Public Action CloseMenu { get; set; }

In your MenuView override OnBindingContextChanged and set ()=>{ this.HideWithoutAnimations ();} to CloseMenu property.

Then in your button Command in ViewMode, just invoke CloseMenu will be fine.

@stefandevo
Copy link
Author

ok thanks for the suggestion. Would be nice if you could implement a Command in the controls for it to call to do the same.

@stefandevo
Copy link
Author

Another idea: add a Visbility property to the SlideMenuView. That way I could make a binding to this property from the model. Thanks for the suggestion @rid00z ! [sitting next to me in the Evolve setting]

@ghost
Copy link

ghost commented Aug 3, 2016

How are you guys binding the SlideMenuView to the ViewModel? Are you creating a ViewModel for the SlideMenuView itself, or are you referring to the ViewModel for the Page containing the SlideMenuView? I'm struggling to work out how to do this.

@jessejiang0214
Copy link
Contributor

@james-lavery I create a ViewModel for SlideMenuView. But you can binding to Page's BindingContext, just override page's OnBindingContextChanged function.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants