WPF Window flash notification? - wpf

I've started using the XCEED MessageBox recently, which uses custom chromes (<-I think that's their name) for the title bar, and it seems that there is no handling for the case when a dialog window (or modal dialog in Win32 terms) needs to flash in response to the user trying to click on the (disabled) parent window.
The flashing border animation is usefull to notify a user that he must respond to a dialog before continuing and to give a hint on which dialog window is that.
Is there a way to get notified when a window needs to perform the flash animation in WPF or set XAML triggers for it?

Related

Prevent user interaction with modal dialog while automating UI?

I am automating a "save as" dialog through win32 API in a WPF project. The dialog is called internally from the IOleCommandTarget interface of InfoPath 2013. So I do not have access to how the save as window is initialized as far as a DoModal() method or anything similar.
The issue is I do not want the user to be able to interact with the save as window at all. Some things I have tried are ShowWindow with SW_HIDE, SetWindowPos to move the window off screen or below the main application window, and SetLayeredWindowAttributes to make the window transparent. None of these approaches has worked to hide the dialog.

WPF Notification Balloon using a User Control

I am working in a WPF app in C# and it is really very very sad that WPF doesn't have a NotifyIcon like in the Win forms has. I have seen a lot of articles in the net for a wpf notifyicon balloon notification project. But none satisfied me. See, I have an idea but i don't know how to execute it.
Create a wpf user control with height and width same like the notifyicon.
Put a border control in it with corner radius 5. Put a grid inside that border control to place the textblocks and images.
Then position that user control to the system tray area. When we click a button from a window, this user control shows up just above the system tray and it hides when we click on outside area.
Is this possible to place the user control [this new "notifyicon" ] just above the system tray area ???
You can do this using an AdornerDecorater in you XAML.
Check this project out GitHub. It has a configurable notification toast popup control for WPF with a demo app.

Hosted window in WPF doesn't get mouse messages

Taking it a bit further than hosting WinForms user controls in my WPF application, I am actually hosting Delphi forms, i.e. top level windows. I am doing so through the voodoo in blog post How To Host Top-Level HWNDs In WPF.
Nearly everything works perfectly. I send a COM server, built in Delphi, a menu path string, and it sends back a window handle, which I pass to the host control described in the blog. The Delphi window receives nearly all events (rather, Windows Messages) correctly, without any intervention on my part.
The only problem is the buttons. They receive a click event/message fine, and work, but now the Delphi guys have added new icons to the buttons, and each button has an active icon, a hover icon, and a click icon. They receive none of the messages they should to change these icons. Why do nearly all messages work except these? What can I read and or do to try and correct this?
In MouseOver event, send some user message and catch it.
WPF and Win32 Interoperation
HWNDs inside WPF > Notable Differences in Input behavior
While the mouse is over the HwndHost, your application does not receive WPF mouse events, and the value of the WPF property IsMouseOver will be false.

How to show an Alert window always on top even if a new window is invoked with ShowDialog later on

In my app I have few windows which are displayed using ShowDialog, but we are trying to implement an Alerts window, if Alert window is raised we want it to be always on top even if the ShowDialog window are raised afterwards.
I have set the Alerts window's TopMost and TopLevel properties to 'true', but if a ShowDialog window comes up later, have noticed that even though Alerts window is on top, it is not clickable, while the ShowDialog window is behind, it is clickable and only after closing it the Alerts Window is accessible.
Any idea on how to achieve this?
ShowDialog creates a Modal dialog. This means that the dialog MUST be closed before interaction is allowed with the main application (this is enforced by windows).
You need to use modeless dialogs (Use Show instead of ShowDialog to achieve this), or as #rheitzman suggested, make the alerts a different application so the modal dialog rules no longer apply.

Silverlight App inside WPF WebBrowser?

I have a hopefully trivial question. Currently, my company works with a rather obscure language (SyngergyDE) and we need to call a SilverLight application inside our product. Unfortunately, this obscure 3rd party language only (currently) supports the opening of WPF screens. So with that said, I thought I'd develop a small WPF user control that contains a "WebBrowser" control and navigate to the silverlight application's URI. This works fine, and I'm able to see the SL application. Here is my question - we have a "Close" button on the SL application, and when users "Click" that button, we want the window to close.
Does anyone have any suggestions on how we can communicate the "Closing of the SL App" to the WPF user control, so that the entire WPF user control closes as well?
Thanks everyone,
-Tom
Attach an event handler to the WebBrowser.Navigated event.
Have the close button in the Silverlight application use:-
HtmlPage.Window.Navigate(new Uri("about:blank", UriKind.Absolute));
When the Navigated event fires in WPF with the url "about:blank" then its time to close the control.
Use Javascript and the HTML DOM as the glue here.
For example, when the SL app close button is clicked, have Silverlight trigger some Javascript code that sets a flag, or alternately, raises some HTML document event.
The WPF control could poll that flag in the HTML + Javascript, or alternately listen for that HTML document event, then close the user control.

Resources