yalematta
yalematta

Reputation: 1389

ExtendedSplashScreen with custom size and Animation C# UWP

I am trying to accomplish my UWP App by adding an ExtendedSplashScreen. In UWP the SplashScreen should have specific dimensions and should be added in SplashRect in the centre of the Page. I want:

  1. Splash taking all the screen size (for different screen sizes)
  2. Make an animation of displaying different pictures after each others.

Could this be accomplished? Is it allowed in UWP design guidlines? Any help accomplishing this?

Upvotes: 0

Views: 678

Answers (1)

Sunteen Wu
Sunteen Wu

Reputation: 10627

Could this be accomplished?

Yes,I have uploaded a completed demo to meet your requirements. You can download the CSplashScreen solution for testing. To meet your requirement,

Make an animation of displaying different pictures after each others.

I implement this with a FlipView control and a DispatcherTimer. So the splash screen can display the picture one by one automatically.

Splash taking all the screen size (for different screen sizes)

The FlipView always fit the window's size and the image displayed full window in different devices.

Xaml code:

<FlipView x:Name="ImageFlipView">
   <Image Source="ms-appx:///Assets/caffe600320.jpg" Stretch="Fill" />
   <Image Source="ms-appx:///Assets/cafee2.jpg" Stretch="Fill" />
   <Image Source="ms-appx:///Assets/caffe3.jpg" Stretch="Fill" />
</FlipView>

Code behind:

private SplashScreen splash; // Variable to hold the splash screen object
internal bool dismissed = false; // Variable to track splash screen dismi
internal Frame rootFrame;
private readonly DispatcherTimer _timer;

public ExtendedSplash(SplashScreen splashscreen, bool loadState)
{
    this.InitializeComponent();
    StatusBar statusbar = StatusBar.GetForCurrentView();
    statusbar.HideAsync();
    if (splash != null)
    {
        splash.Dismissed += new TypedEventHandler<SplashScreen, Object>(D
    }
    rootFrame = new Frame();
    _timer = new DispatcherTimer
    {
        Interval = TimeSpan.FromSeconds(2)
    };
    _timer.Tick += ChangeImage;
    _timer.Start();
}

private void ChangeImage(object sender, object e)
{
    var totalItems = ImageFlipView.Items.Count;
    var newItemIndex = (ImageFlipView.SelectedIndex + 1) % totalItems;
    ImageFlipView.SelectedIndex = newItemIndex;
}   
void DismissedEventHandler(SplashScreen sender, object e)
{
    dismissed = true;            
}

Is it allowed in UWP design guidlines?

From the official document Display a splash screen for more time,

Make sure your extended splash screen accurately imitates the default splash screen by following these recommendations:

The document has recommendations on creating your own extended splash screen. The best practice is to follow the recommendations. And the guidelines for splash screens also suggest us :

  • Don't use the splash screen or your extended splash screen to display advertisements.
  • Don't use your extended splash screen as a mechanism to display multiple, different splash screen images. The purpose of the splash screen and extended splash screen is to provide a smooth, polished loading experience for your users.
  • Don't use the splash screen or your extended splash screen to display an "about" page.

Upvotes: 1

Related Questions