Closed Tum4ik closed 5 years ago
@Tum4ik Thank you for your report.
AiForms.Effects removes each effect when the page has been popped. When a page is a singleton, once the page is popped, each effect will be not active when the page is pushed again.
If you want to active each effect each time page is pushed, you should use non-singleton instance or use bindings to notify true for "On" property when the page is pushed.
Ok, I've understood, thanks for your clarification!
hm... but actually I can't access the StackLayout element in the FloatingView. I guess it is because the StackLayout is not inside the ContentPage content.
I still can't get the expected behavior. In some reason it doesn't work even if I use non-singleton pages. Because I never dispose the MainPage means never dispose SettingsPage.
@Tum4ik
FloatingView's children can also be accessed by "x:Name" attribute. In the above code, attach "x:Name" attribute to the StackLayout.
About the issue of singleton, I think that it is solved by using "OnAppearing" and "OnDisappearing" methods:
<StackLayout x:Name="stacklayout">
...
protected override void OnAppearing()
{
base.OnAppearing();
AiForms.Effects.Border.SetOn(stacklayout, true);
}
protected override void OnDisappearing()
{
base.OnDisappearing();
AiForms.Effects.Border.SetOn(stacklayout, false);
}
Hi @muak ,
Unfortunately your suggestion is not working. When I use just OnAppearing() method it has the same behavior (the frame disappears on the second settings page opening). When I add OnDisappearing() method it crashes the app when I try to open settings page second time.
Since you wrote "AiForms.Effects removes each effect when the page has been popped." I guess AiForms.Effects removes also the StackLayout element, because it is inside "ef:Floating.Content -> ef:FloatingLayout -> ef:FloatingView"
It seems only one way exists: create a new Settings page on every push. But in this case the DI is impossible what is not the purpose.
Is it possible to implement functionality to avoid removing each effect when the page has been popped? I also use "AddTouch" feature and it also stops to work when I switch between different pages in my app.
Ok, I've reconfigured the lifetime scopes for the pages. Now it works good.
@Tum4ik I'm sorry for the delay of reply. It was good to resolve it.
I have two pages in my application: MainPage and SettingsPage. MainPage has a button to open the SettingsPage. I use Autofac as IoC container. Both my pages are singletons. My App class looks like:
The MainPage code to show SettingsPage looks like:
In the SettingsPage I've added some kind of a frame using AiForms.Effects:
So, when I go to the SettingsPage I see the frame. But if I go back to the MainPage and then again go to the SettingPage the frame disappears.
Is that a bug or I am doing something wrong?