[UWP] [C#]尝试通过代码在Windows 10移动设备中实现完整视图但在Windows 10中的桌面视图上部署时会出现未处理的异常
问题描述:
我正在尝试在Windows中实现完整视图10个移动视图通过代码。它在移动设备上运行良好并填补了空白,但在为桌面视图部署相同代码
时出现以下错误:
L_c_uwp.exe中0x00007FFCB9BFD1C4(twinapi.appcore.dll)的未处理异常:0xC000027B:应用程序内部异常发生
(参数:0x000000C517DFECF0,0x0000000000000001)
如何解决这个问题?任何建议都将不胜感激。 Xaml
<Grid>
<MediaElement x:Name="myMediaElement"
Source="/Video/splash_3.mp4" AutoPlay="True"
CurrentStateChanged="MediaElement_CurrentStateChanged"/>
</Grid>
C#代码
public MainPage()
{
this.InitializeComponent();
RemoveGap();
}
private void MediaElement_CurrentStateChanged(object sender, RoutedEventArgs e)
{
if (myMediaElement.CurrentState == MediaElementState.Paused)
{
this.Frame.Navigate(typeof(Home));
}
}
public async void RemoveGap()
{
await StatusBar.GetForCurrentView().HideAsync();
}
答
您好Vikasssss,
Hi Vikasssss,
尝试使用ApplicationView.TryEnterFullScreenMode()
Try using ApplicationView.TryEnterFullScreenMode()
public void RemoveGap()
{
ApplicationView.GetForCurrentView().TryEnterFullScreenMode();
}
Windows.Desktop似乎不支持StatusBar本身。
StatusBar itself doesn't seem to be supported in Windows.Desktop.
StatusBar类
https://msdn.microsoft.com/en-us/library/windows/apps/windows.ui.viewmanagement.statusbar.aspx
StatusBar class
https://msdn.microsoft.com/en-us/library/windows/apps/windows.ui.viewmanagement.statusbar.aspx