I was just interested in something. I have a frame that loads pages, and currently every page has a Page_Loaded
method that will run every time the page is available. This works fine, but I notice errors if I use navigation to go to previously visited pages. Upon returning to the page, Page_Loaded
is called again, which I do not need.
Using debugging, I noticed that InitializeComponent
was called only on the first page call and was wondering if I could just put the Page_Loaded
code after this call like this:
public partial class MyPage: Page { public MyPage() { InitializeComponent();
This will solve my problem, but is this a bad practice? And if so, what problems can I encounter in the future?
Thanks Cohan
source share