AjBernababe
AjBernababe

Reputation: 21

Prism Dialog: How to Add Flashing Effect When Main Window Is Blocked?

I’m working on a WPF project using Prism, and I’ve implemented dialogs with Prism’s IDialogService. Everything works as expected: the main window is blocked while the dialog is open, and I also get a notification sound if I try to interact with the main window while the dialog is active.

However, I noticed one thing is missing: when I try to interact with the main window, the dialog doesn’t flash or flicker to indicate that it requires my attention, as most applications do.

Is there a way to add this flashing effect to the dialog when the main window is blocked?

Here is my current set-up, just a simple implementation to test that everything works.

// Dialog View Model

internal class SupplierFormViewModel : BindableBase, IDialogAware
{
    public string Title => "Add Supplier";

    public DialogCloseListener RequestClose { get; }

    public bool CanCloseDialog() => true;

    public void OnDialogClosed() { }

    public void OnDialogOpened(IDialogParameters parameters) { }

    private void CloseDialog(IDialogResult result) { }
}

// Execute Dialog

internal class SupplierDatabaseViewModel
{
    private IDialogService _dialogService;

    public DelegateCommand AddCommand { get; }

    public SupplierDatabaseViewModel(IDialogService dialogService)
    {
        _dialogService = dialogService;

        AddCommand = new DelegateCommand(ShowForm);
    }

    private void ShowForm()
    {
        _dialogService.ShowDialog("SupplierFormView");
    }
}

I don't have any extra codes inside my xamls

Thank you!

Upvotes: 0

Views: 25

Answers (0)

Related Questions