Quantcast
Channel: Xamarin.Forms — Xamarin Community Forums
Viewing all articles
Browse latest Browse all 58056

Reusing form pages?

$
0
0

I'm trying to re-use a Xamarin.Forms.Page with the hope that it retains its state a little better after configuration changes (screen rotation etc).

However, I'm getting the following exception:

     UNHANDLED EXCEPTION: System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.NullReferenceException: Object reference not set to an instance of an object
       at Xamarin.Forms.NavigationProxy.set_Inner (INavigation value) [0x00000] in <filename unknown>:0 
       at Xamarin.Forms.VisualElement.OnParentSet () [0x00000] in <filename unknown>:0 
       at Xamarin.Forms.Page.OnParentSet () [0x00000] in <filename unknown>:0 
       at Xamarin.Forms.Element.set_Parent (Xamarin.Forms.Element value) [0x00000] in <filename unknown>:0 
       at Xamarin.Forms.Element.OnChildAdded (Xamarin.Forms.Element child) [0x00000] in <filename unknown>:0 
       at Xamarin.Forms.Page.OnInternalAdded (Xamarin.Forms.VisualElement view) [0x00000] in <filename unknown>:0 
       at Xamarin.Forms.Page.InternalChildrenOnCollectionChanged (System.Object sender, System.Collections.Specialized.NotifyCollectionChangedEventArgs e) [0x00000] in <filename unknown>:0 
       at System.Collections.ObjectModel.ObservableCollection`1[Xamarin.Forms.Element].OnCollectionChanged (System.Collections.Specialized.NotifyCollectionChangedEventArgs e) [0x00000] in <filename unknown>:0 
       at System.Collections.ObjectModel.ObservableCollection`1[Xamarin.Forms.Element].InsertItem (Int32 index, Xamarin.Forms.Element item) [0x00000] in <filename unknown>:0 
       at System.Collections.ObjectModel.Collection`1[Xamarin.Forms.Element].Add (Xamarin.Forms.Element item) [0x00000] in <filename unknown>:0 
       at Xamarin.Forms.NavigationPage.PushPage (Xamarin.Forms.Page page) [0x00000] in <filename unknown>:0 
       at Xamarin.Forms.NavigationPage..ctor (Xamarin.Forms.Page root) [0x00000] in <filename unknown>:0 

Can we re-use pages? Would doing so preserve things like scoll positions and item selections etc?


Viewing all articles
Browse latest Browse all 58056

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>