Xaml 如何以编程方式设置PageOrientation.scape?WindowsPhone8c#
我想把全屏图标栏放在全屏上播放视频 对于“我拿什么”应用程序栏按钮:Xaml 如何以编程方式设置PageOrientation.scape?WindowsPhone8c#,xaml,windows-phone-7,windows-phone-8,microsoft-metro,Xaml,Windows Phone 7,Windows Phone 8,Microsoft Metro,我想把全屏图标栏放在全屏上播放视频 对于“我拿什么”应用程序栏按钮: private void BuildLocalizedApplicationBar() { // Set the page's ApplicationBar to a new instance of ApplicationBar. ApplicationBar = new ApplicationBar(); // Create a new
private void BuildLocalizedApplicationBar()
{
// Set the page's ApplicationBar to a new instance of ApplicationBar.
ApplicationBar = new ApplicationBar();
// Create a new button and set the text value to the localized string from AppResources.
ApplicationBarIconButton appBarButton = new ApplicationBarIconButton(new Uri("/images/AppbarIcon/wallpaper.png", UriKind.Relative));
appBarButton.Text = "FullScreen";
ApplicationBar.Buttons.Add(appBarButton);
appBarButton.Click += appBarButton_Click;
}
然后我编写click事件以使其工作:当我们单击时,我希望页面为横向:,我可以使用emulator右侧按钮来执行,但无法通过代码执行:
void appBarButton_Click(object sender, EventArgs e)
{
//SupportedOrientations = SupportedPageOrientation.Landscape;
this.Orientation = PageOrientation.Landscape;
}
当页面方向改变时,我想触发这个事件:当我从模拟器右侧按钮执行操作时,它将被触发
private void PhoneApplicationPage_OrientationChanged(object sender, OrientationChangedEventArgs e)
{
if (e.Orientation == PageOrientation.Landscape ||
e.Orientation == PageOrientation.LandscapeLeft ||
e.Orientation == PageOrientation.LandscapeRight)
{
TitlePanel.Visibility = System.Windows.Visibility.Collapsed;
player.Height = Double.NaN;
player.Width = Double.NaN;
player.VerticalAlignment = System.Windows.VerticalAlignment.Stretch;
player.HorizontalAlignment = System.Windows.HorizontalAlignment.Stretch;
SystemTray.IsVisible = false;
}
else
{
TitlePanel.Visibility = System.Windows.Visibility.Visible;
player.Height = Double.NaN;
player.Width = Double.NaN;
player.VerticalAlignment = System.Windows.VerticalAlignment.Stretch;
player.HorizontalAlignment = System.Windows.HorizontalAlignment.Stretch;
SystemTray.IsVisible = true;
}
}
此代码将使您的页面横向:
void appBarButton_Click(object sender, EventArgs e)
{
this.SupportedOrientations = SupportedPageOrientation.Landscape;
this.Orientation = PageOrientation.Landscape;
}
此代码将使您的页面横向:
void appBarButton_Click(object sender, EventArgs e)
{
this.SupportedOrientations = SupportedPageOrientation.Landscape;
this.Orientation = PageOrientation.Landscape;
}
此代码将使您的页面横向:
void appBarButton_Click(object sender, EventArgs e)
{
this.SupportedOrientations = SupportedPageOrientation.Landscape;
this.Orientation = PageOrientation.Landscape;
}
此代码将使您的页面横向:
void appBarButton_Click(object sender, EventArgs e)
{
this.SupportedOrientations = SupportedPageOrientation.Landscape;
this.Orientation = PageOrientation.Landscape;
}