WPF Notification Balloon using a User Control - wpf

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.

Related

ActiveX control doesn't get focus when right-clicked

I'm working on an ActiveX control which is hosted in MFC and VB6 applications.
This ActiveX contains a WPF control, itself hosted by a WinForms ElementHost, i.e.:
MFC > .NET ActiveX > WinForms ElementHost > WPF UserControl
When an user right-clicks on the control, he must be able to navigate in the contextual menu using the keyboard arrow keys.
If my control has the focus when the right-click occurs, everything works fine.
But if the focus is in the host application when the user right-clicks, keyboard events continue to be sent to the host MFC application.
I tried to call the Focus() method on my WPF control when I detect the right click, but it doesn't work.
Does anybody have an idea ?
Thanks.
I have found a workaround.
When the PreviewMouseRightButtonDown event occurs on the WPF form, I call the Focus method on the WinForm host control.
I don't really understand why, but this lets users use their keyboards to navigate in the contextual menu.

WPF Window with Control in Full Screen Mode

I have a WPF window hosting a web browser control. I want this WPF window to always be on top. Now for example user surfs to a Youtube page and the web player plays a video. User clicks on the full screen button in the Youtube player and the video fills the screen. But my WPF window that hosts web browser control now is still on top of everything and it looks weird because in the background, the video plays fullscreen.
Is there any way an embedded control can tell WPF window that it's in fullscreen mode now so that the WPF is no longer on top, say maybe hidden?
Thanks for any advice!
Try to play with Topmost property. If you display content not in Popup than this should works:
window.Topmost = false;

WPF control similar to outlook new mail alert in the taskbar tray

Is there a WPF control or technique to emulate Outlook's new mail alert in the bottom right of the taskbar tray?
This would probably be a good solution.

How to force control ignore any gui events in Silverlight

I have a simple page with canvas control.
Inside canvas I have some SL controls like buttons, textboxes etc.
Also I cover the controls by semi-transparent Image control. So, when I click on some button, the click message doesn't reach the button, because I click on Image.
Is there a way to say the Image that it must not handle any gui events ?
p.s I use SL4
You should add IsHitTestVisible="False" to your image.

How to prevent WebBrowser control from stealing focus from other text box in my WPF form

My WPF app has a window with various text boxes and a WebBrowser control.
The WebBrower control is used to show a web site (I doesn't own) and then a Login button in the WPF window fills the fields in the site from the text boxes.
The problem is that the web site calls focus() method on one of its input fields on load, and that still the focus from the text box in my WPF window. I want the focus to be on the WPF window field and not in the web page within the WebBrowser control.
I tryed calling MyTextBox.Focus() in the WebBrowser's LoadCompleted event, but to no avail. Setting the WebBrowser's IsEnabled or even Visibility properties didn't help either.
Does anyone have an idea how I can overcome this and move the focus to the WPF control instead of the web page input field?
Don't think you can extend the control site to add IProtectFocus to the site. Try interop the Windows Forms version of the webbrowser control and override the CreateWebBrowserSiteBase method to provide your own control site.

Resources