I do something similar. When the page orientation is changed I close a panel in my application. I do this in the event fired when the orientation of the device changes.
public MainPage()
{
InitializeComponent();
this.OrientationChanged += OnOrientationChanged;
}
private void OnOrientationChanged(object sender, OrientationChangedEventArgs e)
{
var orientação = e.Orientation;
}
View documentation here
EDIT
Windows Phone doesn’t have an event with an easy name for you to identify that indicates this event will be triggered before the screen orientation is changed, but there is this event.
Beginlayoutchanged event is triggered before the phone orientation is changed.
BeginLayoutChanged += (o, args) => MessageBox.Show("Antes de Mudar");
OrientationChanged += (o, args) => MessageBox.Show("Depois de Mudar");
More information about the event here
Some problems: I know I didn’t say, but it is windows phone 8.1 RT, it only serves for Silverlight. Still, even if it were the case, that code is executed later the exchange of guidance. :/
– Felipe Avelar
Please see the reply update.
– Washington Morais