Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>You can pass information on what needs to be displayed on the Details page through the Navigate call and set the DataContext in OnNavigatedTo override to avoid using static variables. Pages don't get created unless you do it specifically e.g. by navigating to one. They might not be recreated if a page has NavigationCacheMode changed from the default (Disabled) so instances of the page can be reused during navigation calls. Ultimately it's hard to say what's wrong but it seems like something in your code and we couldn't help you if you don't share a sample that reproduces the problem.</p> <p>*EDIT</p> <p>One way to debug <code>Details</code> being created before <code>MainPage</code> would be to add this code at the beginning of the <code>Details</code> constructor:</p> <pre><code>if (MainPage.matchFullDetails == null) { System.Diagnostics.Debugger.Break(); } </code></pre> <p>Then look at the <code>Call Stack</code> panel in Visual Studio to see how it gets constructed.</p> <p>One way to see if <code>matchFullDetails</code> is ever set to null is to search for its assignment (put a cursor on <code>matchFullDetails</code> in Visual Studio code editor and hit Shift+F12). </p> <p>Another way would be to make matchFullDetails into a property and test it like this:</p> <pre><code>private static ObservableCollection&lt;Match&gt; _matchFullDetails; public static ObservableCollection&lt;Match&gt; matchFullDetails { get { return _matchFullDetails; } set { if (value == null) { System.Diagnostics.Debugger.Break(); } _matchFullDetails = value; } } </code></pre> <p>*EDIT 2</p> <p>You can initialize your static property in a static constructor like this:</p> <pre><code>public static ObservableCollection&lt;Match&gt; matchFullDetails; static MainPage() { matchFullDetails = new ObservableCollection&lt;Match&gt;(); } public MainPage() { this.InitializeComponent(); UpdateController update = new UpdateController(); // Creating new object will update the overview_list of UpdateController(static list). overviewlistbox.ItemsSource = UpdateController.overview_list; } </code></pre> <ul> <li>this will prevent the null reference exception but won't fix your problem overall. When your app gets suspended and resumed - you have to restore the full state and it seems like your matchFullDetails collection would need to be serialized and saved to disk when your app gets suspended. Alternatively you might simply ignore the suspension manager call in App.xaml.cs and always start on home page, though that's not a very good experience and I am not sure if it satisfies app certification.</li> </ul>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload