How can I detect what browser my Silverlight application is running in? - silverlight

I need to know because I have to run external (popup) features that use ActiveX (which I can't help). I want to disable (or hide) buttons that activate these features.

Have you looked at HtmlPage.BrowserInformation.UserAgent?

Related

Gesture support for WPF WebBrowser Control which is displaying a HTML5 Site

In a standard WPF app, I have a WebBrowser control which has been navigated to a HTML5 sample page (http://ie.microsoft.com/testdrive/Browser/BrowserSurface/).
In the browser outside the app, I can interact with this site as expected – move photo’s around, use gestures etc.
In the WebBrowser control the site does not work as expected. It renders, but it does not respond to any touch gestures – It will, however, zoom in and out when I pinch.
Is it possible to make the WebBrowser control pass gesture events etc so that I can interact with the site as I would in a normal browser?
Many thanks for any help with this!
Kris
I know this is an old question but I think this has something to do with the fact that the WebBrowserControl standard uses IE7 ActiveX. I had the same problem which always gave me JavaScript errors in the control for TouchEvents.
After I added some registery key to force the WebBrowserControl to use the latest IE version installed it worked.
Here is what I've add to my registery. Paste it in a txt file and save it as an .reg file. Then DoubleClick it. Or enter the key/value manual in your registery via Regedit.
I even included this in my application code to add the key/value automaticially if it doesn't exist yet.
Windows Registry Editor Version 5.00
[HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\Internet Explorer\MAIN\FeatureControl\FEATURE_BROWSER_EMULATION]
"RetailTestApplication.exe"=dword:270f
[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Internet Explorer\MAIN\FeatureControl\FEATURE_BROWSER_EMULATION]
"RetailTestApplication.exe"=dword:270f
Sorry, the code plugin srews up.
Change IE version for the WPF WebBrowserControl
MSDN Internet Feature Controls (B..C)

Disable shortcut/shotkeys of browser in Silverlight?

I am trying to add some shortcut handlers like Ctrl+B in my Silverlight application.
However, in IE when we press the Ctrl+B, it comes out a child window of " Organize Favorings". Is it possible to disable these browser shortcuts with Silverlight?
Many many thanks!
Mrainy
I'm not sure you can judging by what I've read. You may be able to hack it with javascript code on the page that passes it on to the silverlight application, however. (See javascript/silverlight interop)
If you need to use common shortcuts in your application perhaps you should consider running it in Out of Browser mode.
You can find out more about OOB on the MSDN:
http://msdn.microsoft.com/en-us/library/dd550721(v=vs.95).aspx
http://msdn.microsoft.com/en-us/magazine/dd882515.aspx

Alternatives to WebBrowser control in WPF?

We are working on a WPF app with the web browser control. When the user drags the window, the web browser lags behind the window as it drags.
Does anyone know how to solve this issue? Failing that, does anyone know an alternative to the web browser control itself?
Thanks!
Yes, as long as you don't require IE specific features you can use Awesomium which basically gives the same browser engine used by Google Chrome except for everything is rendered in pure WPF. For a while it was open source but I believe it is becoming a commercial product.
I haven't heard about any Native WPF WebBrowser Control. The only options I know are based on Win32 controls which are wrapped into WPF controls in order to displayed. (See more details at http://msdn.microsoft.com/en-us/library/ms752055.aspx )
Recently I have to use the WPF wrapper for the WebBrowser control, and it's very limited regarding the options available for the developer. During my research I found that you are able to inject scripts or html content in order to modify the page behavior. Also, you can call .NET code (e.g. CSharp function from Javascript).
However tasks such as accessing the cache, modifying cookies are difficult task or changing the web browser behavior are very difficult. Here is when you will have to use DLL Imports in order to invoke unmanaged routines (see http://msdn.microsoft.com/en-us/library/aa984739(v=vs.71).aspx )
It's possible to look for an alternative WebBrowser control such as:
http://code.google.com/p/csexwb2/
http://wpfchromium.codeplex.com/
I hope this helps
You can try CefSharp.Wpf which uses Chromium as a base browser. You can find it on NuGet

how to play flash in WPF application

I have a WPF application and I want to play flash movies in it.
I used the WInforms active X control as described in this link
It worked partially, but now whenever I run the application it crashes saying "InvalidActiveXStateException"
does anyone have an idea how to solve this?
I would recommend adding a WebBrowser control to your WPF application and allow IE to load the URL of the Flash Movie directly; which in turn would load the Flash Plugin. You will need to build your WPF application as x86 only for this to work on x64 Windows.
I found a solution.
You can use a AxShockwaveFlash.
see this link

Silverlight 3 - Can I run Out-of-browser inside another application

The new Silverlight 3 beta includes the ability to run Out-of-Browser applications. The demos so far show this only inside a special frame. Does anyone know how I can run Siverlight 3 controls inside a (WPF) application?
No, you can not embed out-of-browser silverlight into WPF. The sllauncher.exe standalone frame has a special handler for the offline://(hostname).(revision)/ url given to it to allow the app to have all the features of out-of-browser mode (like extra keyboard access). Unless you can find a way to embed this app into your app, you won't be able to get out-of-browser; if you know some way to do this the address for this app is:
C:\Program Files\Microsoft Silverlight\3.0.40307.0\sllauncher.exe
As others have said, however, you can embed a silverlight control inside of an html page and that inside a WebBrowser element. Be cautious with this method, however, since there is currently no x64 support for Silverlight and if you absolutely must do this make sure to compile specifically for x86.
I'm guessing (yes, shame on me!) but you can probably put a WPF web browser on your window and navigate to the Silverlight app inside it.
This is a supported scenario; a recent MSDN article stated this scenario was supported, and scenarios like this forced the CLR team to allow multiple CLRs loaded into a single process.
It seems that SLOOB apps run inside a host process (C:\Program Files\Microsoft Silverlight\3.0.40307.0\sllauncher.exe). This hosts and sandboxes the app.
I suspect that it will not be possible to host it yourself - sorry if that's a little close to guessing, but short of running a hosting web browser in your WPF app I can't think of a way around the sandboxing requirement.
HTH
You can host a browser control inside a windows app, and load silverlight inside the browser control. This is how live mesh is going to do it.

Resources