private void OnListPickerModeChanged(ListPickerMode oldValue, ListPickerMode newValue)
{
if ((ListPickerMode.Expanded == oldValue))
{
if (null != _page)
{
_page.BackKeyPress -= OnPageBackKeyPress;
_page = null;
}
if (null != _frame)
{
_frame.ManipulationStarted -= OnFrameManipulationStarted;
_frame = null;
}
}
if (ListPickerMode.Expanded == newValue)
{
// Hook up to frame if not already done
if (null == _frame)
{
_frame = Application.Current.RootVisual as PhoneApplicationFrame;
if (null != _frame)
{
_frame.AddHandler(ManipulationStartedEvent, new EventHandler<ManipulationStartedEventArgs>(OnFrameManipulationStarted), true);
}
}
if (null != _frame)
{
_page = _frame.Content as ListPickerPage;
if (null != _page)
{
_page.BackKeyPress += OnPageBackKeyPress;
}
}
}
if (ListPickerMode.Full == oldValue)
{
ClosePickerPage();
}
if (ListPickerMode.Full == newValue)
{
OpenPickerPage();
}
SizeForAppropriateView(ListPickerMode.Full != oldValue);
IsHighlighted = (ListPickerMode.Expanded == newValue);
}