Ticket T1279251
Visible to All Users

WPF Splash screens - best approach to add a cancel button?

created a day ago

I'm working on adding some developer tools for our new enterprise application. To that end, I'd liek to be able to add an optional Cancel button. I'd modify my ShowSplashScreen to take in a CancellationTokenSource.

I'd liek the cancel click to trigger that cancellation. What is the best approach to accomplish such a goal? A lot of the devex samples I've looked at seem rather out of date with the Splash Screens you are showing today.

As of now, I'm just using the WaitIndicator class. I understand I'll probably need to be able to roll my own XAML splash, and that's fine.

C#
/// <summary> /// Show a small splash screen /// </summary> /// <param name="owner">The parent UI element</param> /// <param name="text">the text to show on the splash screen</param> public static void ShowSplashScreen(DependencyObject owner, string text) { var activeSplashScreen = DevExpress.Xpf.Core.SplashScreenManager.ActiveSplashScreens .FirstOrDefault(); if (activeSplashScreen == null) { var splash = DevExpress.Xpf.Core.SplashScreenManager.CreateWaitIndicator( new DevExpress.Mvvm.DXSplashScreenViewModel { IsIndeterminate = true, Title = string.Empty, Subtitle = string.Empty, Copyright = default, Status = text, Logo = default }, topmost: false); splash.Show( showDelay: 250, minDuration: 1000, owner, WindowStartupLocation.CenterOwner, trackOwnerPosition: true, DevExpress.Xpf.Core.InputBlockMode.None); } else { activeSplashScreen.ViewModel.Status = text; } }

Answers approved by DevExpress Support

created a day ago

Hello Greg,

We demonstrated how to display a cancelable splash screen in the following public ticket: T868679 - WPF Splash Screen - Show a Cancelable Wait Indicator. This example demonstrates how to utilize SplashScreenManagerService with a custom view. To bind the required command, this solution utilizes DXSplashScreenViewModel's Tag property:

XAML
<dx:SimpleButton Margin="20" HorizontalAlignment="Right" VerticalAlignment="Top" Command="{Binding Tag}" Glyph="{dx:DXImage GrayScaleImages/Edit/Delete_16x16.png}" ToolTip="Cancel and Close" />
C#
vm.Tag = new DelegateCommand(CancelOperation, CanCancelOperation);

Please let me know if this solution meets your requirements.

Regards,
Alexander

    Disclaimer: The information provided on DevExpress.com and affiliated web properties (including the DevExpress Support Center) is provided "as is" without warranty of any kind. Developer Express Inc disclaims all warranties, either express or implied, including the warranties of merchantability and fitness for a particular purpose. Please refer to the DevExpress.com Website Terms of Use for more information in this regard.

    Confidential Information: Developer Express Inc does not wish to receive, will not act to procure, nor will it solicit, confidential or proprietary materials and information from you through the DevExpress Support Center or its web properties. Any and all materials or information divulged during chats, email communications, online discussions, Support Center tickets, or made available to Developer Express Inc in any manner will be deemed NOT to be confidential by Developer Express Inc. Please refer to the DevExpress.com Website Terms of Use for more information in this regard.