Comments (7)
Well As SlideOverKit doesn't have bindable properties for show and hide popups, so it means you cannot control it from ViewModel.
But there is a solution for that, in FreshBasePageModel you can use this.CurrentPage property to get current page, then convert current page as MenuContainerPage, then call ShowMenu();
from slideoverkit.
I'm not sure what it means when you say
then convert current page as MenuContainerPage, then call ShowMenu();
How is this done?
I've tried in the buttonclick of the model
public Command buttonClicked { get { return new Command(() => { var page = this.CurrentPage as MenuContainerPage; page.ShowMenu(); }); } }
But this is not going to work. I also cannot change the ContentPage to MenuContainerPage
public partial class TestPage : ContentPage
Because it's a partial class and the generated code also refers to it as a ContentPage.
How would I get the MenuContainerPage built?
Thank you for your help as I think others have needed this as well. I really like slideoverkit and hope I can use.
from slideoverkit.
You TestPage must inherit from MenuContainerPage or IMenuContainerPage, otherwise you cannot use SlideOverKit.
Here is the document http://www.xam-consulting.com/slideoverkit-xamarin-forms/
from slideoverkit.
I've brought in all the renders into my project as the document specified, and the classes. Where I'm stuck is I've built my own MenuContainerPage as follows using the FreshMvvm Base.
public class FreshMvvmMenuContainerPage : FreshBasePageModel, IMenuContainerPage, IPopupContainerPage {
But because the FreshBasePageModel doesn't have a Page base, I can't get it to call the renderer when i execute the ShowPopupAction.
I can grab the Page from CurrentPage in FreshBasePageModel, but I'm lost on how to connect it to the renderer without having MenuContainerPage be the base. I know I'm doing something wrong, but not sure what.
from slideoverkit.
I am happy to have some progress so I'll post here in case someone else finds this and its helpful. So to have the popup show inside my Model and ModelPage was alot simpler than I thought.
-
I changed my ContentPage on the Xaml.cs to
` public partial class TestPage : MenuContainerPage
{
public TestPage()
{
InitializeComponent();
PopupViews.Add("FirstPopup", new PopOverView());} public void OnClicked() { ShowPopup("FirstPopup"); }
}
` -
Changed the Xaml using sample provided for SlideOverKit and
`
<local:MenuContainerPage xmlns="http://xamarin.com/schemas/2014/forms"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
x:Class="MyApp.Pages.TestPage"
xmlns:local="clr-namespace:MyApp.Classes.SlideOverKit;assembly=MyApp" ><ContentPage.Content>
</ContentPage.Content>
</local:MenuContainerPage>`
This allowed the page to operate. Then if I wanted to open the popup from inside the model, I just changed the button onclicked to use the command and included.
` public Command buttonClicked
{
get
{
return new Command(() =>
{
var page = this.CurrentPage as MenuContainerPage;
page.ShowPopup("FirstPopup");
}
}
`
Although after more consideration, I think generally this would mean the view logic of the popup would be in the model, and should be in the xaml.cs as part of the view. Regarldess.
I did not pursue making the popup actually use a model/view. I think this would be too much work for the amount of use this will have. For just the couple screens, I decided just to not use model phylisopy for the popup.
from slideoverkit.
You can create a Bindable property in xaml.cs file, and then binding this property with ViewModel, like ShowPopup, when this property changed you can show or hide the menu from XAML code behind.
from slideoverkit.
I tried adding a property. #79 but I'm stuck on knowing why it isn't building for me. Also, I noticed a bunch of PR from jessicarich1980 that never got merged, so I assuming mine won't be accepted either anytime soon.
But you can probably do what I did, subclass the container page and add the bindable property. I am using it that way and it works.
from slideoverkit.
Related Issues (20)
- AnimationDurationMillisecond not working on Android HOT 1
- Android: Right to Left menu does not animate first time HOT 2
- iOS: Right Menu doesn't show items HOT 2
- Displays blue screen with Shell HOT 1
- Please set SildeMenuView WidthRequest HOT 1
- Fetch Web Service Data
- CarouselPage into Slide
- Right to Left slide menu not opening after DsiplayAlert HOT 2
- Is this project maintaned? HOT 2
- [iOS] Issue with tabbed page and bottom bar
- XAML duplicate sliders oddity? How to call via XAML? HOT 1
- Keyboard overlap entry android
- [iOS] SlidePopupView - ListView content not displayed HOT 1
- Xamarin.mac support
- Mvvm
- [iOS] Label not showing
- The Action delegates ShowMenuAction / HideMenuAction are null HOT 3
- When an AlertDialog is presented, the "SlideMenuView" is not show when in "this.IsFullScreen = true;" mode.
- is there a way to show two SlideMenuView in same MenuContainerPage with two diferent buttons? HOT 1
- InnerMenu Sample not working on IOS
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from slideoverkit.