How to inspect a tooltip using Live Visual Tree? - wpf

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.

Related

How to prevent overriding from button styles in WPF

out current application is a DevExpress Ribbon window. However, we have some legacy code - including a WPF Control which was hosted through a WinForms Window - with WPF Host. (please dont ask why)
I wanted to change the UserControl at least to a Wpf Window to get rid of WinForms.
Now here is my Problem: All stlyes get totally messed up. Especially my buttons have a problem:
The buttons lose their assigned Images, and also Background and Foreground is not assignable. Through the Live Visual Tree from Studio I see that it is overridden.
I guess the thing with images leads to the same root cause.
I dont want to redo the whole window again in DevExpress (if this is the cause).
Is there a way for a window to not use some application styles and run as default? Or how can I find out, what is actually overriding everything?
I finally found the solution. The DevExpress was overriding any styles of any form in application, settings something to the DevExpress.Xpf.CoreTemeManager.
To disable a style, I had to add the following thing to my window:
<Window x:Class="AnotherWindow"
xmlns:dx="http://schemas.devexpress.com/winfx/2008/xaml/core"
dx:ThemeManager.ThemeName="NoneName"
<!-- ...-->
</Window>
Also include DevExpress.Data and DevExpress.Xpf.Core references.

Visual studio addin - window children can't get focus

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.

Why does my Attached Property show in Blend designer but not in VS2010?

I have an attached property and I am registering it with the designer using a design-time assembly. I am using the AttachedPropertyBrowsableForTypeAttribute so that the property will be shown when a TextBox is selected.
The property shows up fine in Expression Blend 4, but does not show in Visual Studio 2010 SP1.
Does anyone know why it would not show up in Visual Studio?
You can download a test project demonstrating the problem from here:
Test Project
Thanks!
The short answer is indeed because the Cider designer is a complete piece of crap. Here's the longer answer:
From a Microsoft blog:
One thing to keep in mind is that one of the requirements of showing
attached properties in the designer is that the owning type needs to
have been loaded by the designer. This happens whenever the designer
accesses the type because it is in the XAML source or is a dependency
of an element loaded from the XAML source.
So the problem is the Cider designer only cares about types which have already been loaded. You can see an example of this by changing your containing Grid to a StackPanel: the Grid.Row and Grid.Column attached properties will then disappear from the list of TextBox properties within Visual Studio. The Blend design surface is somehow more forgiving and recognizes your type. In addition, Blend dutifully displays the Grid.IsSharedSizeScope (under Layout properties) even when using a StackPanel.
Looking at how Microsoft uses and supports attached properties, they seem to favor using them on layout containers. For example there's the AttachedPropertyBrowsableForChildrenAttribute. It's so you can do things like show Canvas.Left for children of a Canvas element. I get the impression they did not thoroughly consider how most people actually are using attached properties today (bolting functionality onto the side of an object versus having functionality flow downhill from a parent).

Toolbar Button with Context Menu? Like New Project Button in Visual Studio

I need a toolbar button similiar to the "New Project" button in the standard Visual Studio toolbar. When clicked, it pops up a dialog. However, it also has a small little down-arrow next to the icon graphic that, when clicked, expands a context menu with more options.
Is there a standard control available with this functionality?
I don't think there's built in functionality for a SplitButton in WPF currently. Here's another thread that may help you out though:
WPF SplitButton?
You could combine a couple of controls together to make one fairly quickly. Might as well make a new UserContol out of it that can be re-used throughout your app as well.
Also, a quick search on WPF SplitButton will return a lot of examples on how to make one or you could get one off of CodeProject or CodePlex (though I'm not sure if they'll come with a image property automatically).

Visual Studio design time event handling

I am trying to create a WPF wizard control in visual studio. I am successful except I would like to navigate the pages in design time by clicking the next and previous buttons. The pages are being written in xaml. I can navigate the pages by going to the properties window and changing the selected index, but I would like something more user-friendly. I remember doing something similar in a winforms project having something to do with overriding maybe wndproc and listening to mouse click events from the designer.
So I've been googling and I can't seem to google the right words to bring this up.
Can anyone please help!
You need to create a custom Adorner as described here. There are two walkthroughs there that should help.
Ultimately, you would need to overlay a transparent button on top of your actual buttons. Then in the click handlers you'd update your selected item/index.

Resources