I'm trying to implement full view in Windows 10 mobile view through code. It's working fine in mobile, but when deploying the same code for desktop view I get the following error:
Unhandled exception at 0x00007FFCB9BFD1C4 (twinapi.appcore.dll) in L_c_uwp.exe: 0xC000027B: An application-internal exception has occurred (parameters: 0x000000C517DFECF0, 0x0000000000000001)
How to resolve this? Any suggestion would be appreciated.
XAML
<Grid>
<MediaElement x:Name="myMediaElement"
Source="/Video/splash_3.mp4" AutoPlay="True"
CurrentStateChanged="MediaElement_CurrentStateChanged"/>
</Grid>
C# code
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();
}
Windows 10 Desktops does not have Status Bar so calling await StatusBar.GetForCurrentView().HideAsync();
causes error.
Instead, we need use the ApiInformation class to check for the presence of StatusBar as this class only exists in Mobile Device (See Requirements → Device family).
if (ApiInformation.IsTypePresent("Windows.UI.ViewManagement.StatusBar"))
await StatusBar.GetForCurrentView().HideAsync();
For more info, please see Dynamically detecting features with API contracts
User contributions licensed under CC BY-SA 3.0