Limitations of Windowless mode for Silverlight
There seems to be a fair amount of misunderstanding about windowless mode, and the current documentation doesn't provide enough detail to help out. The upcoming doc refresh will fix this, but I thought it might be helpful to provide some information here.
When you use windowless mode with the Silverlight plug-in, you are effectively telling the browser to render your Silverlight content directly, instead of giving the plug-in its own window for rendering. The main reason to use windowless mode is when you want your Silverlight content to blend with your HTML content, which the browser can do only when it is in charge of all the rendering. With windowless mode, you can layer Silverlight content on top of HTML content and HTML content on top of Silverlight content.
For example, you might want to display a map using HTML, but add a layer that uses Silverlight vector graphics in order to highlight certain features of the map. Of course, to create a Silverlight layer on top of HTML, you must use a transparent or translucent background both for the Silverlight plug-in, and for the content hosted within the plug-in (typically a UserControl).
The overlay scenario works pretty well when you keep things simple. Unfortunately, when the browser has the responsibility of rendering the Silverlight content directly, there are numerous things that it cannot do, or cannot do well. Furthermore, some of the limitations depend on which browser is doing the rendering.
The current documentation does contain a warning that windowless mode has a significant performance impact, which makes it unsuitable for complex animations and video playback. However, this limitation has not been sufficient to keep people away from windowless mode.
I am not recommending that you avoid windowless mode entirely, but I do strongly recommend that you do not use it casually. For example, if you use it for special effect purposes (such as creating a non-rectangular Silverlight-based application on top of a complex HTML background), you should carefully consider whether the special effect is worthwhile given the limitations listed below.
In some cases, you can achieve the desired special effect without using windowless mode, although it might take a little more work. For example, to achieve the effect of a non-rectangular Silverlight-based application, you can provide a UserControl background that blends seamlessly with your HTML background. (Of course, this is easier to achieve with solid-color backgrounds as opposed to backgrounds with complex images.)
When you do use windowless mode, I also recommend that you test your code with a variety of platforms and browsers to make sure that your target audience is seeing what you expect.
Now for the complete list of limitations, which I have added to the documentation for the next update. Please note that this is not a list of bugs that might be fixed in future versions of Silverlight. It is a list of limitations that would take considerable effort to work around. Therefore, you should not expect these limitations to disappear over time.
Limitations of windowless mode for Silverlight:
- Performance issues. Windowless mode is computationally expensive, especially in combination with a transparent plug-in background. For more information, see Performance Tips.
- No support for passing mouse input to HTML content that the plug-in overlaps, even if the plug-in has a transparent background. To process mouse input through HTML, the HTML must overlap the Silverlight plug-in.
- No mouse capture support outside the boundary of the plug-in.
- No accessibility or IME support.
- No support for windowless mode in full-screen mode.
- No support for suppressing popup blockers when using hyperlink navigation to new windows. Note also that popup blocker suppression is not supported on Safari regardless of the windowing mode.
- Issues due to browser and platform limitations:
- Visual tearing in animation and video playback on Windows XP, on Windows Vista with DWM disabled, and in Internet Explorer, regardless of platform.
- Unreliable rendering when overlapping HTML content in Safari.
- Focus issues in Mozilla-based browsers. When the focus moves between the plug-in and other plug-ins or HTML controls, multiple controls will sometimes appear to have focus.
Comments
Anonymous
November 12, 2008
PingBack from http://www.tmao.info/limitations-of-windowless-mode-for-silverlight/Anonymous
November 12, 2008
It seems that you forget the real reasons why many people use windowless mode: to have support for mouse wheel and right-click events which are not doable without this. PatrickAnonymous
November 13, 2008
Thanks for the tip, Patrick. I have updated the post to reflect the scenario of creating an HTML layer on top of a Silverlight layer, which is necessary for the mouse wheel and right-click handling that you mention. -KarlAnonymous
November 13, 2008
In this issue: Pencho Popadiyn, Dan Wahlin, Lee, Karl Erickson, Larent Bugnion, Manish Dalal, and AdamAnonymous
November 15, 2008
The comment has been removedAnonymous
November 17, 2008
The comment has been removedAnonymous
January 06, 2009
The comment has been removedAnonymous
April 21, 2009
Windowless mode is the only way to create user interfaces that blend HTML and Silverlight, regardless of which one is on top. Without Windowless mode, the Silverlight plug-in has its own window, which is always on top, and cannot blend in HTML UI from underneath. -KarlAnonymous
April 04, 2011
Hi Karl. Good and useful blog. One of the limitations that is standing out for me as stark is No accessibility or IME support What is your recommendation to test applications developed with windowless mode turned ON ? Creating non-testable applications should be a bigger concern for application developers that actually developing the application itself. Appreciate your thoughts. Regards, AshishAnonymous
April 18, 2011
@Ashish - Are you referring to testing with UI Automation? It is true that the lack of accessibility support means that there is no UI Automation support either. You could turn off windowless mode for testing purposes, but With windowless mode, you are presumably blending HTML and Silverlight content. Depending on the effect you are trying to achieve, it might not be worthwhile to test the Silverlight side by itself using UI Automation. I don't have any recommendations around UI automation with windowless mode, but you might consider using a Model-View-ViewModel (MVVM) architecture in order to minimize the amount of UI-dependent code that needs testing.Anonymous
June 19, 2012
Any way to work Mouse wheel scroll in Mozilla under windowless mode param set to true?Anonymous
May 21, 2014
If windowless is true, keyboard switching (ALT+SHIFT) not working on 'Chrome 35.0.1916.114 m' and 'Firefox 29.0.1'. Keyboard is still same as in operating system. On IE 11 OK.