Recently in a car information, news, parameter query client, there are many use of network requests and list display, so I use pivot to display the contents of the items:
However, each of the network request APIs is different, so you want to send different network requests. Since pivot is displayed under the same page, I have to consider a question:
How does this load of pivot affect the data request in the end? are multiple items loaded at the same time? Does this have performance requirements?
With these questions, I did the next test, set breakpoints at each PivotItem loaded event, debug, and find that all PivotItem loaded events will be triggered as soon as the page is entered, so will all the data be loaded at this point? Of course not, Microsoft has taken into account the performance problems in real-world applications. So, I did the following test, in the PivotItem of the child control to add to listen to its loaded event, found that only when the page is moved to this event, it will trigger the incident, so the conclusion is:
When the pivot control enters the entire page, each PivotItem loads a "frame frame" that occupies its own position, but the object is not loaded, and it is only loaded when it is moved to a PivotItem.
Also, it is worth noting that when I am doing this application, the result of the network request is to be processed in the collection, which encapsulates the method of requesting the network data, and once the collection class is initialized, the network request is executed, such as the interface shown, which binds more data sets, and each collection is in the new object. Will trigger a network request. As long as the collection is bound, then, in a sense, here will trigger the network request, but, testing, when entering this page, because the binding source is not the current PivotItem, so the collection object is not immediately initialized, so did not go directly to request the network, Network data is not requested until the bound object is active until the corresponding PivotItem is scratched.
All I can say is that it's great! I also worry that so many pages will be requested at the same time, there is a performance problem, it seems to worry about, as long as the list of virtualization, asynchronous incremental loading, and the cache is OK! You are welcome to join the UWP Hobby Exchange Group: 193148992. Learn together and explore together.
--it Chase Dream Garden
UWP Development: Some of the details of pivot controls when loading data