Determining Load Status RRS feed

  • Question

  • I have code that I want to call when changing orientations, but I only want to call it when the orientation is changed AFTER the initial load. I call the code in the Loaded event, which makes the page display correctly when it first opens, but not when the user rotates their phone to change the orientation. If I put the code in the OrientationChanged event handler, I get an error because the code uses values from controls that have not yet been loaded, and the Loaded event is only called once, so it will not be called for changes in orientation. How can I call my code when the orientation changes EXCEPT for the initial load? I thought about using a variable that I set in the Loaded event to keep track of whether it is the initial load or not, but is there any better way? Thanks.

    Nathan Sokalski njsokalski@hotmail.com http://www.nathansokalski.com/

    Thursday, October 30, 2014 7:25 PM


  • Nathan - flags like you're describing at the perfect way to get this behavior. Don't overthink this. :-)

    Matt Small - Microsoft Escalation Engineer - Forum Moderator
    If my reply answers your question, please mark this post as answered.

    NOTE: If I ask for code, please provide something that I can drop directly into a project and run (including XAML), or an actual application project. I'm trying to help a lot of people, so I don't have time to figure out weird snippets with undefined objects and unknown namespaces.

    Friday, October 31, 2014 1:41 PM