HypernovaDesktop Components · docs
Binarymission
WPF › Slide Show

Slide Show

.NET Framework 4.8.NET 6 / 8 / 10v2.0.0WPF

A slide show: shows a list of slides one after another, on a timer or under your control, with any of twenty-three transition effects between them – for kiosks, product tours, photo galleries, dashboards that cycle through views, and presentations.

4public types
68public members
1namespaces

Assembly

AssemblyBinarymission.WPF.Controls.InteractionControls.SlideShow.dll
Root namespaceBinarymission.WPF.Controls.InteractionControls
Target frameworks.NET Framework 4.8, .NET 6 / 8 / 10
Depends onBinarymission_Shaders_Library

Overview

Slides

Each slide is a BinarySlideShowItem holding any content. Add them to Slides, which every slide show starts with, empty. To show a single slide of your own choosing, set SlideContent or call PlayThisSlide.

Playing

Play starts the timer, which shows the next slide every SlideTransitionTimerInterval milliseconds, going back to the first after the last; the first slide appears one interval after the start. Pause, Resume and Stop control the timer, and StartSlideShowOnceInstantiated plays without a call. The timer runs only while the control is on screen, so a slide show on a page the user has left stops by itself and carries on when the page is shown again.

Moving by hand

Next, Previous, GoToFirstSlide, GoToLastSlide and GoToThisSlide move through the slides – from buttons, or the arrow keys. Each action raises an AboutTo... event first, such as AboutToGoToNextSlide; set CancelEventArgs.Cancel in it to stop the action.

Caution

Next, Previous, GoToFirstSlide and GoToLastSlide pass the slide they move to as the outgoing side of the transition, so with the SlideTransitionEffect.Default, Slide and SlideFromBottom effects the slide shown changes to it only at the following move or timer tick. GoToThisSlide and the timer show the new slide at once.

Effects

SlideTransitionEffect chooses the transition, and can be changed between slides. Several effects use the control's own UIElement.Effect, UIElement.RenderTransform, UIElement.OpacityMask or template, so leave those to the control.

Getting started

A self-running kiosk show with a fade every five seconds, and buttons to move by hand.

<Window x:Class="Kiosk.MainWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:show="clr-namespace:Binarymission.WPF.Controls.InteractionControls;assembly=Binarymission.WPF.Controls.InteractionControls.SlideShow"
        Title="Welcome" Width="1024" Height="640">
    <DockPanel>
        <StackPanel DockPanel.Dock="Bottom" Orientation="Horizontal" HorizontalAlignment="Center">
            <Button Content="Previous" Margin="4" Click="OnPrevious" />
            <Button Content="Next" Margin="4" Click="OnNext" />
        </StackPanel>
        <show:BinarySlideShow x:Name="Tour" SlideTransitionEffect="Fade"
                              SlideTransitionTimerInterval="5000" StartSlideShowOnceInstantiated="True" />
    </DockPanel>
</Window>
using System;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using Binarymission.WPF.Controls.InteractionControls;

foreach (string file in new[] { "lobby.jpg", "showroom.jpg", "workshop.jpg" })
{
    Tour.Slides.Add(new BinarySlideShowItem
    {
        Content = new Image { Source = new BitmapImage(new Uri("pack://application:,,,/Slides/" + file)), Stretch = Stretch.Uniform }
    });
}
Tour.AboutToGoToNextSlide += (sender, e) => e.Cancel = Tour.Slides.Count == 0;

private void OnNext(object sender, RoutedEventArgs e) { Tour.Next(); }
private void OnPrevious(object sender, RoutedEventArgs e) { Tour.Previous(); }

API reference

Binarymission.WPF.Controls.InteractionControls

class BinarySlideShowA slide show: shows a list of slides one after another, on a timer or under your control, with any of twenty-three transition effects between them - for kiosks, product tours, photo galleries, dashboards that cycle through views, and presentations.
class BinarySlideShowItemOne slide of a BinarySlideShow: any content - a picture, a page of text, a chart, a whole layout - to be shown in turn.
class SlideShowEventArgsThe data of the slide show's AboutTo... events, such as AboutToPlay: where the show is, and a Cancel flag to stop the action.
enum SlideTransitionEffectThe effects BinarySlideShow can move from one slide to the next with.