【发布时间】:2014-06-27 23:12:04
【问题描述】:
我想把全屏图标栏全屏播放视频,
对于我采取的应用程序栏按钮:
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;
}
然后我编写单击事件以使其工作:当我们单击时,我希望页面为横向 :,我可以使用模拟器右侧按钮进行操作,但无法通过代码进行操作:
void appBarButton_Click(object sender, EventArgs e)
{
//SupportedOrientations = SupportedPageOrientation.Landscape;
this.Orientation = PageOrientation.Landscape;
}
当 PageOrientation 改变时,我想触发这个事件:当我从模拟器右侧按钮执行时,它会触发。
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;
}
}
【问题讨论】:
标签: xaml windows-phone-7 windows-phone-8 microsoft-metro