Keyboard focus problems - wpf

I am needing to use the DotNetBrowserControl inside of another application (I am an add-in in the application). The application is written in WPF and has some WinForms components.
When I try to use the WPFBrowserView in the app I can never get focus to go into the Browser Window at all (even when clicking on a the google search box for example).
When I try to use the WinformsBrowserView inside of a WindowsFormsHost control I am able to get focus into the google search box by clicking on it. However once I click focus out of the browser control (to a WPF textbox for example) I can never get Keyboard focus back into the browser (even when clicking on a textbox in the browser).
It seams I am closest on getting the WInformsBrowserView working. Does anyone have any advice on how to force focus into the browser window? Even if I could programmatically force this to happen it would be a huge help.

We have implemented force focus feature for DotNetBrowser, but it is not yet present in the current version. We plan to add it to the next version of DotNetBrowser. If you need a build with this feature present, please get in touch with us via DotNetBrowser support email, and we will provide you with a preview build.

Related

Enabling microsoft accessibility for Flex Window hangs application after clicking on identified object

After enabling accessibility for a flex window object, I fired an object.click which brought up a dialog-box. After closing the dialog box, the application went to hung state. So I found the coordinates of object using getrect , restarted both application and silk, kept accessibility disabled clicked on the mainwindow using the coordinates and the problem did not recur. The problem even when I retrieved the coordinates with accessibility and manually clicked on the icon.
I am even unable to fetch locator hierarchy with accessibility enabled when I try to retrieve for objects that are visible only through enabled accessibility. Nothing is captured (blank recorder hierarchy) and the recording stops working any further. I guess the agent goes into some kind of loop or excepts out. Kindly advise.
This was a product issue and got this fixed - not an issue on SilkTest side

Restore Tab Focus From CEFSharp

I have a WPF application that hosts a CEF browser using CEFSharp. I've found that if I navigate my application's controls using keyboard tabbing, I can cycle through my controls without problem. Once focus makes it to the ChromiumWebBrowser control, focus shifts to within the current web page, as expected. However, once focus makes it within the web page, I can never get focus back out to my application. Hitting tab at the end of the html document just moves focus back to the top of the page, rather than pushing focus back to my application.
I have tried implementing IFocusHandler, but IFocusHandler.OnSetFocus() gets called right when the application is launched and none of the handler methods ever get called again.
How can I move focus back to the host application when tabbing reaches the end of a document in CEFSharp?
UPDATE:
Since this is a bug in CEF that has yet to be fixed, here are a couple relevant links to check on later to see if any progress has been made.
CEFSharp issue: https://github.com/cefsharp/CefSharp/issues/721
CEF issue: https://bitbucket.org/chromiumembedded/cef/issues/1826/focus-handler-not-called-for-offscreen

In Silverlight, How can I disable Back and Forward navigation using browser buttons?

I'm using the Navigational Framework in Silverlight 4. I'm starting to believe that this was a mistake as the browser buttons are really screwing things up for users. For instance, when a child window is opened the user believes they can close the window by pressing the back button. It doesn't close the window obviously, it just navigates the parent page back a step. The end result is a messed up data set. I'm fed up with the little control I have over the navigation of my application; forward and back buttons are anachronistic. Web applications don't work that way anymore. Please someone tell me how I can disable their functionality; that is, cancel navigation when it is started from one of these buttons.
Remove this code from your html page which holds your silverlight XAP:
<iframe id="_sl_historyFrame" style="visibility:hidden;height:0px;width:0px;border:0px"></iframe>
This is the history frame.
You will likely have to do this in the actual web/asp.net page, as Silverlight has no real control over the browser.
Some workarounds in this article:
http://lennilobel.wordpress.com/2009/07/26/defeat-the-evil-back-button-in-your-asp-net-applications/

Can Silverlight hook into the browser's Edit > Cut/Copy/Paste menu items?

We have a Silverlight app that contains a grid, and we've added support for selecting multiple cells, copying their contents to the clipboard, and pasting back elsewhere in the grid. Currently the user invokes the Copy and Paste commands by either clicking a toolbar button inside our Silverlight app, or using the standard keyboard shortcuts, which we catch with a KeyDown event.
Is it possible to also hook into the browser's native Edit menu, and the Cut, Copy, Paste, etc. menu items that are built into the browser? For example, can the user drop down the Firefox button (or press Alt+E to drop down the classic Edit menu), click the Copy item in Firefox's menu, and have some sort of Copy command be relayed to the focused control in my Silverlight app? Same thing for the equivalent menus in IE, Chrome, Opera, etc.
I wouldn't be surprised if this can't be done, since even long-established browser plug-ins like Adobe Reader have their own buttons for copy/paste and even print, rather than hooking into the browser's native menus. But I've never programmed to a browser's plug-in model, so I don't know for sure what's possible.

Stop Dragging from a WPF WebBrowser control

I have a WPF application which contains a WebBrowser control.
Currently, the user can select something within the WebBrowser and can copy the content by dragging it out to another application and dropping it there.
I'd like to be able to stop the user doing this. I'd assumed that there would be a "DragStart" event that I could capture and cancel - but I haven't been able to find something so simple.
Is it possible to capture the start of drag event and cancel it?
Is there a better way to achieve this?
You can implement IDocHostUIHandler::FilterDataObject and filter out common clipboard formats
You don't get access the WPF browser's native interface until the document is ready. Not sure if it would work with the WPF browser class. There is also a bug in Windows Forms to prevent you from customizing its implementation of IDocHostUIHandler.
You can try some wrapper class of the webbrowser ActiveX, such as the one described at http://www.codeproject.com/KB/miscctrl/csEXWB.aspx

Resources