Search code examples
silverlightsilverlight-oob

How to Minimize Silverlight Application to System Tray


How can I minimize a Silverlight Out Of Browser application to windows system tray? Is it possible?


Solution

  • I like this question! It points to another obvious requirement that microsoft failed to support with OOB apps. Sadly this is not directly supported as part of existing Silverlight API. But having said that we could "explore" achieving this... (the tips below may / may not work as I myself have not tested them yet due to lack of Visual Studio environment currently on my machine!)

    In a silverlight OOB app, the Application class exposes an "Install" method which executes when we select to install the OOB app.

    In this method, you can try installing (using elevated priviliges) of your custom made ActiveX control (windows application) say MySilverlightHost. This app is nothing but a Windows Form having a silverlight host in it.

    Yes! You heard me right. This guy (http://firstfloorsoftware.com/blog/hosting-silverlight-outside-the-browser/) has implemented a custom Windows form based silverlight host.

    Now when your OOB is installed, the XAP file which is deployed to your system would be the source for the ActiveX app and will host its content in its Silverlight Host Control. And because it is a windows app, it can be configured to stay in the system tray.

    Let me know if this guides you in correct direction.