0

If you create app and show modal window inside, and then click outside modal, your window will 'flash'.

How can it be done with custom controls, not windows?

Lonli-Lokli
  • 3,357
  • 1
  • 24
  • 40
  • You mean the "flashing" when you user `.ShowDialog()` – Ivan Crojach Karačić Feb 15 '12 at 09:20
  • I understand what flashing you refer to, I'm just not sure where you want the same effect? Do you want to prevent the focus from being lost from your custom control and then emphasize that by flashing? – Andre Luus Feb 15 '12 at 13:08
  • As I'm using DevExpress' window, this is still just a control with customized (themed) label. I wanna style it with flash effect, no prevgenting needed. – Lonli-Lokli Feb 15 '12 at 13:34

1 Answers1

0

The custom window you are using doesn't show a Windows titlebar, hence you cannot see the flashing effect. To make your custom titlebar flash, you'll have to do some work.

I'm not sure this will actually work, but you need to detect the message windows is sending to the Window to make it flash. Look here to see how you can get notified of messages received by the window. This is the code from that page:

using System;
using System.Windows;
using System.Windows.Interop;

namespace WpfApplication1
{
    public partial class Window1 : Window
    {
        public Window1()
        {
            InitializeComponent();
        }

        protected override void OnSourceInitialized(EventArgs e)
        {
            base.OnSourceInitialized(e);
            HwndSource source = PresentationSource.FromVisual(this) as HwndSource;
            source.AddHook(WndProc);
        }

        private IntPtr WndProc(IntPtr hwnd, int msg, IntPtr wParam, IntPtr lParam, ref bool handled)
        {
            // Write some debug messages to the console here to detect what message is sent to the window when you click behind an active modal dialog

            return IntPtr.Zero;
        }
    }
}

Note my comment in the code.

If that works, you can from there trigger an animation in XAML to mimic the flashing effect.

For interest's sake, does the application flash in the taskbar?

Community
  • 1
  • 1
Andre Luus
  • 3,692
  • 3
  • 33
  • 46