0

I've seen a few implementations of tray-located apps now. Despite the urge to develop my own stuff, I think I'd like to give this one a go : http://www.codeproject.com/KB/WPF/wpf_notifyicon.aspx

Anyway, I really wonder whether it is possible to get and control windowstates from an XBAP application. I think it might not be, since they run boxed in the PresentationHost, but I'm not really sure about that.

What I'd like to do: When the browser is closed / minimized, show a tray Icon. Usual tray behavior, but applied to XBAP.

Please also note that the XBAP is running elevated to Full Trust (it's an app for internal usage only), maybe that changes a few things.

Has anybody tried this before?

Cheers,

Sebi

Sebastian Edelmeier
  • 4,095
  • 3
  • 39
  • 60

1 Answers1

0

If your XBAP is running with full-trust, then you can certainly add an item to the notification area. If the browser is closed, then it appears that the notification icon is removed though.

You may need to create a hidden Window to receive messages, but otherwise you would simply use the same technique as with a regular WPF application.

But, it sounds like you may be better off using a Clickonce application.

CodeNaked
  • 40,753
  • 6
  • 122
  • 148
  • hi codenaked, what do you mean by "receive messages"? The main problem I face is that my Page Class has no access to the WindowState, are you relating to this? Anyway, the benefit of maximizing the xbap to tray over simply starting a tray-located second app seems to be vanishingly small...I guess I'll stick with my last resort plan. thanks! – Sebastian Edelmeier Mar 28 '11 at 10:49
  • @Sebastian - In order to handle events from the icon in the notification tray, you need a Window. So if you want to show a context menu when the user right clicks the tray icon, or do something when the user double clicks the tray icon, etc. I'm not sure what you mean by "maximizing the xbap to tray". The icons in the tray are usually used when minimizing an app, not maximizing. In any event, you won't be able to maximize or minimize (or detect when that happens) the web browser (which is running your xbap). But you can create a secondary Window, for which you can perform those operations. – CodeNaked Mar 28 '11 at 11:13
  • As a final comment : I've just read that among the few things you can do in XBAP, there's no chance of opening a standalone window (that would take the application out of it's safe box). – Sebastian Edelmeier Mar 30 '11 at 05:32