Visual studio addin - window children can't get focus - wpf

I have some addin for VS2010 which displays window with some many panels. I'm using Avalon docking manager to handle all panels manipulation.
My problem is that all items (listboxs or items control) within the my window can't get focus, even when I'm clicking on them directly. this problem is expressed when i'm trying to use mouse wheel in order to scroll the scrollViews in my window.
Just want to mention that when I'm using my window in a stand alone application (not as VS2010 addin) everything works.
Any idea? Is this Avalon problem?

It's seems to be bug of Avalon.
Updating to latest version fix the problem.

Related

What should I implement for a small popup control in a VSTO project?

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.

How to inspect a tooltip using Live Visual Tree?

Visual Studio's Live Visual Tree is great for inspecting UI elements. But how can I inspect a tooltip in my application?
I turn on "Enable Selection" in the mini-toolbar that appears that the top of my WPF application's window, but with that turned on, tooltips no longer appear.
If you make the tooltip visible first, it will disappear when you move the mouse to the mini-toolbar.
So this is a Catch-22. Any thoughts appreciated.
Live Visual Tree is a new feature in Visual Studio 2015, I'd say they are very late in catching up for giving tools for WPF Developers.
Please send a bug in Microsoft Connect.
I would recommend to look at Snoop The WPF Spy Utility. It will give you the ability to inspect the tooltip and it's well tested working tool.
I agree with the Snoop recommendation.
If you are new to Snoop, I would add that a valuable hidden feature is to hold down Shift+Ctrl as you hover over your app. This will allow your Snoop window to zero in on the exact element quickly, without the need to manually navigate your visual tree.
You will actually want to snoop the element that has the ToolTip property set, not the ToolTip itself. For example, if the ToolTip is on a TextBlock, simply navigate the Tree on the left (or use the Shift+Ctrl tip) to that particular TextBlock. The ToolTip itself does not need to be showing on the screen. Then on the right side in the Properties Tab, you can filter down to the ToolTip property. If the ToolTip property happens to have a binding, you can see the binding from Snoop as well.

Foxpro hosted Wpf window return focus to foxpro when Tab is pressed

I have a Visual FoxPro 9 application from which I call a wpf window using COM interop. When TAB is pressed for the first time the focus goes back to the FoxPro window. If I come back to the wpf window this happens again until the third time I do it, and then the focus works normally. This occurs using the mouse or Alt+Tab to go back to the wpf window. It happens whether there is a focused element (textbox, datepicker,...) or not.
I have tried to capture the PreviewKeyDown event of the window, but it seems that it happens before it can capture it. I have tested the wpf window in a wpf application and it works ok.
The C Sharp class is like:
[ClassInterface(ClassInterfaceType.AutoDispatch)]
[ProgId("SBN.WPF.Com")]
[ComVisible(true)]
public class WpfFoxPro
{
and the FoxPro calls are like:
oDll = Createobjectex("SBN.WPF.Com", "", "")
oDll.VOpenWPFWindow()
I'm using Visual Studio 2010 and .Net 4.0 and I'm running out of ideas. Does any one know something about this?
Might sound stupid, but could you disable the VFP windows whilst the WPF one is active? It's not a solution, but based on 10 years of working with VFP, sometimes you just have to stop bashing your head against the brick wall and go for the kludge. ;)

Winforms Richtextbox not properly rendered in WPF project

I have a very strange issue in my WPF project. The main window contains several wpf controls and winforms RichTextbox(don't ask me why) within WindowsFormsHost element.
Richtextbox contains text. In some cases Richtextbox is not properly rendered when loading window (the right part is white like somebody uses erase tool and clears a rectangle).
This situation is not so common (~20 users / 30 000) and it probably depends on hw. It occurs on XP machines. I have tried to force sw rendering, but it didn't help.
Application is built in .net 3.5 SP1.
Any idea?
The problem was caused by user's unusuall dpi settings in Window. Strange, but with normal values, it works

TabIndex problem. Only getting a system beep

Background: I've got a WinForm application with a ComboBox and a TabControl with two pages. On page one of the TabControl, I've got a FlowLayoutPanel containing about 10 Panels. Each of those Panels contain a Label and a TextBox. I'm using Visual Studio 2008 as my IDE.
Problem: I'm not able to tab between any of my controls. I go to View-Tab Order, and everything looks fine (although I know it's not). All I get is a system beep when I try to tab between controls.
Anyone else have a similar problem that they overcame? I'm sure I'm missing something really simple, but I don't know what it is. Is there a method to have Visual Studio rebuild the tab indexing?
Figured it out. Instead of using Form.Show(), I used Form.ShowDialog(). Tabbing work correctly after that. Not sure why though.

Resources