Silverlight 4, Mouse Wheel Events and Windowless Mode - silverlight

I have a Silverlight 4 application that benefits greatly from having native mouse wheel support for a number of controls. The page that hosts the application has a HTML driven drop-down menu that would normally overlay the Silverlight control.
In IE, I have to enable windowless mode to allow the overlay menu to work correctly (Firefox 3.6 works normally without it). However, enabling windowless mode prevents Firefox from supporting mouse wheel events without additional coding around the HTML DOM bridge.
Is there any way I can tell which browsers will require windowless and which will work without it? Ideally, I'd like to use the HttpBrowserCapabilities information to decide whether or not to set the property to true, rather than hardcoding a list of 'supported' browsers.

Silverlight 4 has support for mouse wheel events, but there are a number of rules to be aware of:
IE is never an issue
Mousewheel events never work on OS X out of browser, and only via the HTML DOM in-browser.
Windowsless in all other browsers is a no-go because they rely on NPAPI to handle events.
You can get the Mousewheel with browser interoperability features to get to the mousewheel from the DOM as you noted.
HTML DOM will never work when full screen
For a complete breakdown see http://msdn.microsoft.com/en-us/library/dd759034(v=vs.95).aspx.

Maybe you could use your own MouseWehhenManager singleton class that internally considers both DOM and MouseWheelAPI events and provides them in a common way, so your code can use this single interface which works either way?

Related

WPF WebBrowser Control: What browser does it use?

Does the WPF WebBrowser control always use Internet Explorer or does it use the default web browser on the system ?
Regards,
MadSeb
One issue the Web Browser Control has that it’s perpetually stuck in IE 7
rendering mode by default. Even though IE 8 and now 9 have
significantly upgraded the IE rendering engine to be more CSS and HTML
compliant by default the Web Browser control will have none of it. IE
9 in particular – with its much improved CSS support and basic HTML 5
support is a big improvement and even though the IE control uses some
of IE’s internal rendering technology it’s still stuck in the old IE 7
rendering by default.
This applies whether you’re using the Web Browser control in a WPF
application, a WinForms app, a FoxPro or VB classic application using
the ActiveX control. Behind the scenes all these UI platforms use the
COM interfaces and so you’re stuck by those same rules.
See this:
Web Browser Control – Specifying the IE Version
http://www.west-wind.com/weblog/posts/2011/May/21/Web-Browser-Control-Specifying-the-IE-Version
Internet Explorer, though there are "hacks" posted on the internet which allow you to use a workaround in order to launch any browser you like.
This thread seems to explain one of the possible solutions.

Popup Outside the Bounds of the Silverlight Control

I'm simply wondering if it is possible to open one or more non-modal popups or dialogs, which are NOT limited to be displayed and moved within the bounds of the parent Silverlight control. Doesn't seem to be possible, even for out-of-browser installs. I hope I'm wrong :)
While the previous answers are true, strictly speaking it is possible in browser mode to have a real popup. At the moment it can only be done indirectly and with a lot more work than a normal Silverlight popup Window.
Basically you popup a new Silverlight app (or second instance of the current app) in a browser popup window (not a Silverlight popup). Silverlight can create the popup window via calls to Javascript.
The 2 Silverlight instances usually need to communicate data, but there are several solutions to that problem too. Javascript can also talk to Silverlight objects (love that feature) and pass information back or you could simply pass data one-way via URL parameters.
No this is not possible, Silverlight strictly renders to a single window (or if in Windowless mode the specific rectangle provided to it by its host).
As Anthony said this is not possible. I've heard from some of the people involved with Silverlight development that this is an often-requested feature and will most likely be added in an upcoming version. But I'm guessing it would only be available in "out of browser" mode.

Drag and drop between HTML 5 and Silverlight 4

Is it possible to drag an HTML 5 object, e.g. an <a draggable="true">, into a Silverlight 4 control and accept it? We've attempted to build a simple prototype using an HTML 5 example and a trivial Silverlight control but the cursor changes to the no-entry sign whenever we hover over the Silverlight control. We do, however, get drag entry events firing in Silverlight.
Our control happily accepts files dragged from the desktop as expected. We think we've got the HTML 5 drag events set up correctly, and I can possibly get our test published somewhere in case that will help. We've successfully implemented dragging inside a Silverlight control but we now need to integrate with non-Silverlight page components.
Is this actually possible to set up or are we just doing something wrong? Thanks for any advice!
Silverlight Drag drop from external sources currently supports only file lists.
You may however be able to get the <object> tag hosting the Silverlight plugin to respond to a dragging. If so you can use the Silveright HTML Bridge to handle these DOM events. Its a bit of a long shot though.
Short answer, as Anthony says is No.
You can emulate the functionality by using the
the drag entry event and mouse button up event, then create a silverlight control that most closely matches the HTML one you were dragging, and hide the original html control (which should snap back to its original position)...
Its a little messy, but it works...
Incidently, as far as i'm aware, dragging between 2 silverlight instances on the same page would require a similar technique...

Anyone using Windowless mode in a Silverlight business app without animations?

We have a standard business application written in Silverlight for which we need to use Windowless Mode. This "feature" to use a Telerik Silverlight component.
Using Google I have found lots of bad things that can go wrong with windowless mode with regards to mixing HTML content and animations. I am interested in knowing if bad things will happen if the silverlight app is the only content in the browser window.
Thanks in advance for sharing your experience.
Mike
Windowless actually improved the way Silverlight and html interact. Without windowless set, Silverlight is just painted on top of the html. Setting windowless is the only way to have html on top of silverlight or to have a transparent silverlight application.
The major downside to windowless is that it forces silverlight to be software rendered instead of hardware rendered. This means that the power of the GPU can't be utilized for things like animations.
If the silverlight app is the only thing in the browser window, the only real difference between windowless and not is the performance issue mentioned above.
An example of Windowless mode with lots of animations and mixed in HTML is the Office Labs Silverlight site. NOTE: You need to click the "Try in Silverlight" on the plain HTML version of the site to see the Silverlight version.
That site uses a floating iframe to display HTML inside of the Silverlight content. Most of the animations work just fine, however, you can't scale the HTML very easily so the HTML is hidden while some of the animations are performed.
Let me know if you have any other questions about the site.

Track "commands" send to WPF window by touchpad (Bamboo)

I just bought a touchpad wich allows drawing and using multitouch. The api is not supported fully by windows 7, so I have to rely on the build in config dialog.
The basic features are working, so if I draw something in my WPF tool, and use both fingers to do a right click, I can e.g. change the color. What I want to do now is assign other functions to special features in WPF.
Does anybody know how to find out in what way the pad communicates with the app? It works e.g. in Firefox to scroll, like it should (shown on this photo). But I do not know how to hookup the scroll event, I tried a Scrollviewer (which ignores my scroll attempts) and I also hooked up an event with the keypressed, but it does not fire (I assume the pad does not "press a key" but somehow sends the "scroll" command direclty. How can I catch that command in WPF?
Thanks a lot,
Chris
[EDIT] I got the scroll to work, but only up and down, not left and right. It was just a stupid "listbox in scrollviewer" mistake. But still not sure about commands like ZOOM in (which is working even in paint).. Which API contains such things?
[EDIT2] Funny, the zoom works in Firefox, the horizontal scrolling does not. But, in paint, the horizontal scrolling works...
[EDIT 3] Just asked in the wacom forum, lets see about vendor support reaction time...
http://forum.wacom.eu/viewtopic.php?f=4&t=1939
Here is a picture of the config surface to get the idea what I am talking about: (Bamboo settings, I try to catch these commands in WPF)
alt text http://img340.imageshack.us/img340/3751/20091008210914.jpg
Have you had a look at this yet.
WPF 3.5 does not natively support multi-touch (it is coming in WPF 4.0) however the samples in that kit should get you started using the Windows7 Integration Library which access the native Win32 APIs to provide the required support (Don't worry its not real ugly:).

Resources