I have created a C# WPF application. In that i have limited UI components (label, MediaElement, Image sources(4)). I am loading my application with maximized window. When I launch my exe, a Black screen is shown for a second and the actual UI appears.
I set one property i.e., AllowsTranparency = True. It solves the above problem but on cost of a new one i.e., If this property is set to true, the Video played in MediaElement lags a lot.
So, this solution is ruled out.
App.xaml:
<Application x:Class="MainWin.App"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="clr-namespace:MainWin"
Startup="MainWindow.xaml">
</Application>
Main Window.xaml:
<Window x:Class="MainWin.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:local="clr-namespace:MainWin"
mc:Ignorable="d"
Title="" Width="width" Height="height"
Loaded="Window_Load"
WindowState="Maximized"
WindowStartupLocation="CenterScreen"
WindowStyle="None"
AllowsTransparency="False"
Topmost="True"
Opacity="0">
<Grid x:Name="grid" Width="0" Height="0">
<MediaElement x:Name="name" Opacity="0" Visibility="Visible" LoadedBehavior="Play" MediaEnded="Media_Ended" Source="loc" Margin="0,0,0,0"/>
<Image Name="name" RenderOptions.BitmapScalingMode="HighQuality" Source="" Visibility="Hidden" Width="1400" Height="660" Opacity="0"/>
<Image Name="name" RenderOptions.BitmapScalingMode="HighQuality" Source="" Stretch="Fill" Visibility="Hidden" Width="20" Height="12" Opacity="0"/>
<Image Name="name" RenderOptions.BitmapScalingMode="HighQuality" Source="" Stretch="Fill" Visibility="Hidden" InkCanvas.Top="530" InkCanvas.Left="2330" Width="2000" Height="12" Opacity="0"/>
<Image Name="name" RenderOptions.BitmapScalingMode="HighQuality" Source="" Stretch="Fill" Visibility="Hidden" InkCanvas.Top="530" InkCanvas.Left="2330" Width="20" Height="12" Opacity="0"/>
<Image Name="name" RenderOptions.BitmapScalingMode="HighQuality" Source="" Stretch="Fill" Visibility="Hidden" Width="20" Height="12" Opacity="0"/>
<Image Name="name" RenderOptions.BitmapScalingMode="HighQuality" Source="loc" Stretch="Fill" Visibility="Hidden" Width="0" Height="12" Opacity="0"/>
<Image Name="name" RenderOptions.BitmapScalingMode="HighQuality" Source="loc" Stretch="Fill" Visibility="Hidden" Width="20" Height="12" Opacity="0"/>
<Label x:Name="name" Content="text" Width="712" HorizontalAlignment="Center" HorizontalContentAlignment="Center" Visibility="Hidden" Foreground="White" FontSize="font" FontFamily="font" FontWeight="Regular" Opacity="0"/>
<Label x:Name="name" Content="text" Width="1248" HorizontalAlignment="Center" HorizontalContentAlignment="Center" Foreground="White" FontSize="font" Visibility="Hidden" FontFamily="font" FontWeight="Regular" Opacity="0"/>
<Label x:Name="name" Content="text" Width="710" HorizontalAlignment="Center" HorizontalContentAlignment="Center" Visibility="Hidden" Foreground="White" FontSize="font" FontFamily="font" FontWeight="Regular" Opacity="0"/>
<Label x:Name="name" Content="text" Width="710" HorizontalAlignment="Center" HorizontalContentAlignment="Center" Visibility="Hidden" Foreground="White" FontSize="font" FontFamily="font" FontWeight="Regular" Opacity="0"/>
</Grid>
</Window>
I want to remove the Black screen that comes on launch of the application.