如何在全屏模式下显示特定控件 UWP
How to show specific control in fullscreen mode UWP
我为 UWP 平台编写了一个 YouTube 客户端,现在我卡在了全屏模式。我已经基于 MediaElement
和 编写了自己的视频播放器。
当我进入全屏模式时,我得到了这个
.
所以在这种情况下,我需要在全屏模式下显示整个视频播放器控件。但我不知道我应该怎么做。我已经试过了:
private async void fullscreen_Click(object sender, RoutedEventArgs e)
{
if (!fullScreen)
{
ApplicationView.GetForCurrentView().TryEnterFullScreenMode();
mainPageBackup = (Window.Current.Content as Frame).Content as MainPage;
(Window.Current.Content as Frame).Content = this;
}
else
{
ApplicationView.GetForCurrentView().ExitFullScreenMode();
(Window.Current.Content as Frame).Content = mainPageBackup;
}
}
将 IsFullWindow 属性 设为真;
private void OnFullScreenButtonClick(object sender, EventArgs e)
{
videoSource.IsFullWindow = true;
}
实际上有一个简单的解决方案。感谢 Alamakanambra 的评论(在问题下方)。当我进入全屏时,我只是隐藏了我不需要的所有东西。
我创建了一个活动并获得 MainPage
和 VideoPage
订阅。
public event EventHandler SetFullscreen;
private async void fullscreen_Click(object sender, RoutedEventArgs e)
{
SetFullscreen.Invoke(this, null);
if (!fullScreen)
{
ApplicationView.GetForCurrentView().TryEnterFullScreenMode();
mainPageBackup = (Window.Current.Content as Frame).Content as MainPage;
(Window.Current.Content as Frame).Content = this;
}
else
{
ApplicationView.GetForCurrentView().ExitFullScreenMode();
(Window.Current.Content as Frame).Content = mainPageBackup;
}
}
我为 UWP 平台编写了一个 YouTube 客户端,现在我卡在了全屏模式。我已经基于 MediaElement
和
当我进入全屏模式时,我得到了这个
所以在这种情况下,我需要在全屏模式下显示整个视频播放器控件。但我不知道我应该怎么做。我已经试过了:
private async void fullscreen_Click(object sender, RoutedEventArgs e)
{
if (!fullScreen)
{
ApplicationView.GetForCurrentView().TryEnterFullScreenMode();
mainPageBackup = (Window.Current.Content as Frame).Content as MainPage;
(Window.Current.Content as Frame).Content = this;
}
else
{
ApplicationView.GetForCurrentView().ExitFullScreenMode();
(Window.Current.Content as Frame).Content = mainPageBackup;
}
}
将 IsFullWindow 属性 设为真;
private void OnFullScreenButtonClick(object sender, EventArgs e)
{
videoSource.IsFullWindow = true;
}
实际上有一个简单的解决方案。感谢 Alamakanambra 的评论(在问题下方)。当我进入全屏时,我只是隐藏了我不需要的所有东西。
我创建了一个活动并获得 MainPage
和 VideoPage
订阅。
public event EventHandler SetFullscreen;
private async void fullscreen_Click(object sender, RoutedEventArgs e)
{
SetFullscreen.Invoke(this, null);
if (!fullScreen)
{
ApplicationView.GetForCurrentView().TryEnterFullScreenMode();
mainPageBackup = (Window.Current.Content as Frame).Content as MainPage;
(Window.Current.Content as Frame).Content = this;
}
else
{
ApplicationView.GetForCurrentView().ExitFullScreenMode();
(Window.Current.Content as Frame).Content = mainPageBackup;
}
}