Silverlight 5 NotificationWindow captures mainwindow mouse - silverlight

I'm finding that if you use the NotificationWindow with Silverlight 5 runtime in an out of browser app, while the notificationwindow is visible it captures any mouse input in the top left corner of the application's main window.
This can be easily demonstrated for example the sample here : http://forums.silverlight.net/t/212852.aspx/1
You simply add a button so it sits at the top left of the screen. It is not possible to click the button while the NotificationWindow is visible. This does NOT happen on SL4 runtime, but does happen on each of the SL5 machines I have tested.
The area that gets captured corresponds to the size of the NotificationWindow, as if the notification window was located at the top left of the MainWindow. If your NotificationWindow content has any controls, you can even click those controls by clicking in the corresponding location on the main window!
I've hit this problem on a SL4 application where users with Silverlight 5 runtime can no longer use the buttons on the top left of the main window.
Any help would be much appreciated.
Thanks
Danny

Related

How to show a WPF window above a TaskBar icon?

In Google's Chrome App Launcher for Windows, does anyone know how they managed to show the window such that it's centered above the application's icon in the TaskBar? Any kind of solution for C#/.NET would be fine (p/invoke, etc.).
I've searched high and low and there are solutions for the System Tray based on identifying the screen rect of a notify icon, but I have not found one for the TaskBar (except one approach that is based on a screen capture, but it's too fragile for production applications).
Thanks!
-Tom B.
Thanks to NETscape's hint, I found that the way that the Chrome App Launcher makes it look like the window is appearing over the TaskBar icon is by checking the mouse position immediately after starting up, and if the mouse is in the TaskBar area then it shows the window directly above the TaskBar and horizontally centered over the mouse.
You can test this by moving the mouse left or right immediately after clicking the icon, in which cases the window appears to the left or right of the TaskBar icon. If you move the mouse outside the TaskBar area right after clicking it (or launch the app from a Desktop icon) then the window is just anchored to the lower-left corner of the screen.

Custom Window Bar

I'm not sure that's the right way to say it, but what I want is to for my wpf main window to have it's own bar that will behave like a taskbar, and any children windows that will be open from the main one will be placed in that bar in a similar way like the taskbar works in windows - a rectangle showing the window name for example, on click it opens you the window, if you click minimize it will minimize it to the bar, and with some option, to get it out of the main window and move it to the real windows taskbar, with another option for putting it back in. The problem is I don't know if this is even possible, and I don't know the name of such an element, so if anyone can give me any tips I'll be really thankful.
I worked on an application years ago (.NET 3.0: first WPF release!) that did exactly that. We ran into a lot of issues getting it to work, but we were pretty successful in the end. One thing we didn't support was moving it to the Windows taskbar.
The best option would be to set an attached property on each Window. This would register a Window with your custom taskbar, so if you wanted to move the Window out of your custom bar, you'd set the property to false. Setting the property to true would add it to the collection of application windows, as well as register event handlers to track the state of the Window.
One of the major pain points for us was getting the Window animations correct. If you're not running in XP, this probably less of an issue, as the animations in Vista (or is it 7?) and above aren't really showing where a Window is going on minimize. In the end, we had to do a lot of low level Win32 (p/Invoke) work for this.
Take a look at AvalonDock and WPF MDI:
http://avalondock.codeplex.com/
http://wpfmdi.codeplex.com/

WPF Window that only shows in TaskBar

I'm not sure if what I want to do is appropriate, so I'll explain a little.
We've got a large application that takes a while to load. So we have a splash screen.
The Splash screen causes excessive load time on Remote Desktop (terminal server).
So to alleviate this, we want to hide the splash screen when loading on RDP.
But we still need to at least show the user that the application is loading.
So, I was thinking perhaps just show something in the Taskbar (not the system tray), as it will disappear once the application is fully loaded (and be replaced by the main form's Task icon).
However any WPF solution I've looked at, requires a visible form/window to go with the Taskbar status.
Is there any way of showing something in the Taskbar without showing a WPF window?
Or is there another way of showing application load status without something on the screen?
We had same problem.
On remote desktop, we did following steps...
We configured the Splash window to not allow resizing and have only Minimize and Close button.
We removed WindowStyle=None setting so that title bar of the Splash window appeared
We made the Splash window's width and height zero. This way all you see on screen is a small blue rectangle of the title bar with Text "Loading... Please Wait ..." and minimize and Close button.
We used Window's kernel calls to disable title bar's Close button too. This way user was not able to cancel the Splash window.
So all a user could do is to minimize or restore from taskbar.
When restored, all he sees is a title bar's blue rectangle with "Loading..." text. This way the window also claimed its place on the task bar but hid its splash animation and user is also aware that the splash screen is loading. For this you can also update the Title bar's text by appending more fullstops ...
Loading. Please Wait..
Loading. Please Wait...
Loading. Please Wait....
Loading. Please Wait..
I do think you need to look into the root cause of your issue. Possibly looking at threading and parallelism.
However, a simple solution to what you are asking would be to just create a hidden window. One that is transparent, no borders or anything. It could even bet set to a size of 0, 0. That way you would be able to get the taskbar item that you require.

WinForms Touchpad Scrolling

I'm working on a winforms application meant for touchpads and would like the user to be able to scroll through the contents by swiping their finger across the screen. I see that windows (at least windows 7) has this behavior built in for any scrollable control. However the control I'm trying to scroll is a third party control that went ahead and made its own scrollbar elements, so this built in behavior is lost.
I could get the same behavior by placing that third party control in a panel, and letting that panel handle the scrolling. However when the user swipes on that control, its containing panel doesn't hear those events and scrolling never takes place.
Are they any resources on how windows handles touchpad scrolling, or how I could make a panel respond to touchpad swipes when the cursor is inside one of its child controls?

Determining location of tray icon

My application is designed to sit in the system tray and behave similarly to the Network/Volume/Power/Action Centre tray items in Windows 7 (and the equivalent items in Windows Vista). That is, it becomes visible when the tray icon is clicked, and becomes hidden when focus is lost.
The application is written in WPF, but I am currently using NotifyIcon from WinForms for the tray icon.
I would like to know if anyone has any suggestions as to how I might determine the position (i.e. screen coordinates) of my application's tray icon. The default Windows Vista/7 tray items have some way of doing this, since the pop-out windows are centre-aligned above the relevant tray icon.
In Vista this wasn't much of an issue: I had the application permanently set to the bottom-right corner, and this looked fine (though there was no logic included for cases when the taskbar wasn't placed at the bottom of the screen). However, in Windows 7 my application ends up obscuring the new system tray pop-out box, rather than hovering above it like the volume controls, etc., do.
The best solution I've seen in my searches so far is to handle the mouse-up event on the NotifyIcon and use the mouse coordinates to determine the position of the icon. I think I'll end up using this method if unless someone has a better idea, though it's not ideal as the position will vary slightly depending on where within the icon the user clicks.
Windows 7 and higher expose the Shell_NotifyIconGetRect() function, which returns the screen coordinates of the icon's bounding rectangle.
You'll need to provide it the notify icon GUID, though, and I don't know if you can access that property through the managed NotifyIcon class.
Further to this, I've written about a method to find the location of a notify icon when the Shell_NotifyIconGetRect function is not available: http://blog.quppa.net/2010/12/28/windows-7-style-notification-area-applications-in-wpf-part-6-notify-icon-position-pre-windows-7/

Resources