When tabbing through controls in an ActiveX control hosted in IE, once I get to the last control the tab key no longer does anything. I would like it to move the focus outside the ActiveX control to the next html control.
This works fine when the ActiveX control is hosted in a WinForms app, does anybody know how to make this work in the browser?
It may also be relevant that the ActiveX control is a simple wrapper around a WPF control.
I found a hacky solution.
The problem is tabbing out of the WPF control, so I've placed a hidden textbox after the ElementHost within the ActiveX control. Tabbing out of the WPF control moves focus to the hidden control correctly, which upon receiving focus uses SendKeys("{TAB}".
Just typing SendKeys makes me feel a little dirty though, so if anyone has a better solution...
Related
In my VSTO projects (Office 2007 / 2010) I would like to use a small popup control (think Tooltip like features; fade animation and mouse interaction).
I would prefer to use WPF. If I were to do this in WPF I would create a custom Popup Control.
In VSTO, as far as I understand it, I must use a WPF window and then have 2 options, either I put this window in a Windows Form Container or I get the Hwnd of my office app and I add this Hwnd to the Owner property of a WPF Window. Am I correct here?
Creating a whole window, animating it on and off the screen etc to look like a ToolTip seems to be overkill.
So my question is how should I do this. I would prefer WPF.
I don't know if this would work but my first thought is to build a very tiny WPF window which is transparent and start it with the Office App. I can then build a Popup Control (which is a child of this tiny window) which I show and not show at a mouse position. Pretty sure a popup can appear outside the bounds of its parent window.
Just wanted to tidy up my own question with what I did. In the VSTO addin project I added a reference to WindowsBase, PresentationFramework and presentation core.
And then I just follow any tutorial or example that adds a WPF Popup. By popup I mean a System.Windows.Controls.Primitives.Popup. For the Placement I used PlacementMode.Absolute and then used a window point to set its position.
This pretty much answers my question. Of course this popup is literally floating above your office window so you will need to make sure that you control it for example if the office window moves, is minimized and the like.
I am deriving a custom control from StackPanel (or just using the usual UserControl class). This control should be focusable within the application by either tabbing or clicking the control. When focus occurs, based on other criterion the control will expand and show certain elements. The control will also choose a default child control to focus on.
The issue I have is that I can find no way to focus on a UserControl. The Got/LostFocus events don't fire when I click on the control.
I am aware of the Focusable property, but it doesn't seem to be available on any of the client dlls for Silverlight (using v4 of SDK)
What I would really like is some advice on how best achieve the functionality of a panel I can tab to, as the UI design I have in mind hangs on this.
I guess the control you are looking for, is an Accordion or Expander control.
Here, you will find steps to use the Accordion control. Hope that helps.
I have a WinForms User Control (a toolbar) which i would like to add on a WPF user Control, is there any way to do this?
like i want a WinForms User Control (the toolbar) along with other WPF Controls
(datagrid) on a new WPF User Control
I saw a couple of samples that show Windows Forms hosted in a WPF Control. But that is not what i want to see.
This is pretty easy to pull off. There is a handy little thing known as WindowsFormHost all you have to do is declare it in your control's XAML, and nest your forms control inside of it, like so:
<UserControl>
...
<Grid>
<WindowsFormsHost>
<forms:MyFormsToolbarControl/>
</WindowsFormHost>
</Grid>
...
WindowsFormHost lives inside of the normal WPF toolbox so it shouldn't be hard to locate. Meanwhile there is an example of how to produce the equivalent XAML in code at this location...
http://msdn.microsoft.com/en-us/library/ms751761.aspx
You can check out my answer to a similar question here:
WPF hosting a WinForm, Tab Navigation problems
This will also show you how to fix a tabbing issue with windows controls that are sitting inside wpf views.
In my WPF application I'm hosting a custom Windows Form User Control together with other wpf controls. My custom user control is hosted in wpf using a WindowsFormsHost control. This custom user control contains (the parent so to speak) other custom win form controls (children controls). The children controls can be single or composite controls.
How can I capture the leave event on a child control when the user navigates from the last child user control in the parent custom user control to a wpf user control?
According to MSDN (http://msdn.microsoft.com/en-us/library/ms751797.aspx) the leave event is not supported in following scenarios:
Enter and Leave events are not raised when the following focus changes occur:
1. From inside to outside a WindowsFormsHost control.
2. From outside to inside a WindowsFormsHost control.
3. Outside a WindowsFormsHost control.
4. From a Windows Forms control hosted in a WindowsFormsHost control to an ElementHost control hosted inside the same WindowsFormsHost.
Scenario 1 and 2 is exactly what I struggle with. Do you have any solution to this problem? Some workaround or anything is appreciated:)
Best Regards,
OKB
It looks like you have already answered your own question: it isn't supported (i.e. not possible).
This is likely a result of the difference in window hosting used by WPF and Windows Forms - and I am sure the platform would support it if it could.
I have some legacy VB6, which I am hosting inside an ActiveX control, which is in my WPF application.
Despite putting the control inside of a DockPanel, which is inside a ScrollViewer, the VB6 displays outside the bounds of both, sitting on top of the rest of the application.
Does anyone know how I can keep the VB6 inside of the ScrollViewer without it spilling out onto the rest of the application?
ScrollViewer - expands to fill an area
Has a child element...
DockPanel - fixed to the height and width of the VB6 form
Has a child element...
VB6
Any help or guidance will be greatly appreciated.
I don't think you can do this, the ActiveX control is just going to sit on top of any XAML you wrap it in. As a workaround you could try creating a control in WinForms that contains your ActiveX control and handles the scrolling, then embed that in the WPF app. It's a bit hacky, and might be a pain if you need to resize, but it SHOULD work :-)