Closed Petrarca181 closed 11 months ago
Well, being able to test the code would help.
Otherwise I think using it in the constructor is kind of weird. My documentation is probably not clear enough but I personally use the base content directly in xaml, like this
<controls:InteractiveContainer>
<MainView />
</controls:InteractiveContainer>
and remove the MobileNavigation.Push in the constructor of MainWindow. (Of course for "children" page I then use the C# navigation)
If you really want to use it C# behind at this point, use "OnLoaded" instead of the constructor, because the problem is that the view isn't loaded yet even if you call it after InitializeComponent, so like this
public MainWindow()
{
InitializeComponent();
}
protected override void OnLoaded(RoutedEventArgs e)
{
MobileNavigation.Push(new MainView());
base.OnLoaded(e);
}
<controls:InteractiveContainer>
<MainView />
</controls:InteractiveContainer>
this still not works, but adding InteractiveContainer to the MainView(first landing page) actually fixes everithing.
I have another aquestion. How to properly setup page transition effects for your navigation system? I'm preaty new in avalonia, but documentation is preaty dry and there is any real sample :(
Yes, if you are developping for Mobile by the way, it's normal that MainWindow does not work.
About transitions between page when Push or Pop, I have to modify ContentControl to TransitioningContentControl (https://docs.avaloniaui.net/docs/controls/transitioningcontentcontrol)
It already works, but there is an issue in Avalonia that "corrupts" the page when using the transitioningcontentcontrol making it blank or deformed, and it happens too often to be usable.
https://github.com/AvaloniaUI/Avalonia/issues/9387 https://github.com/AvaloniaUI/Avalonia/pull/11326
I'm following these issues because as soon as it's solved, I can change the contentcontrol to a transitioningcontentcontrol and add automatically a nice transition when changing page.
Thank you. I will wait for updates.
Thank you. I will wait for updates.
Actually maybe I won't use transitioningcontentcontrol because I think that 'push' and 'pop' should have different transition. I work on a custom navigation transition for the next update.
Hi was testing your controls. I'm facing a problem.
MainWindow
Here it works fine and navigates to the MainView, but when I try to navigate from MainView to the Page2 I get the following error.