wp7 页面方向
public partial class Page1 : PhoneApplicationPage
{
public Page1()
{
InitializeComponent();
this.SupportedOrientations = SupportedPageOrientation.PortraitOrLandscape; // 这句话很重要
OrientationChanged += new EventHandler<OrientationChangedEventArgs>(Page1_OrientationChanged);
}
// 改变屏幕事件
void Page1_OrientationChanged(object sender, OrientationChangedEventArgs e)
{
if (e.Orientation == PageOrientation.LandscapeLeft
|| e.Orientation == PageOrientation.LandscapeRight)
{
TitlePanel.Visibility = Visibility.Collapsed;
}
else
{
TitlePanel.Visibility = Visibility.Visible;
}
}
}