This feature may not seem useful initially, and might appear distracting you. But it is one of the very useful (new) features in Visual Studio 2010. You'll love it after using it for a while!
While debugging, you typically put some variables in Watch Window (or use Locals, Autos etc). When you keep adding expressions/variables in Watch window, this list goes large and becomes clumsy, unreadable.
With
DataTips, you can place variables or expressions as a floating content. It would appear the same way when you hover mouse over a variable - as a tooltip. But when you move mouse away from variable, the tooltip goes away.
When you add the expression using DataTips, it would remain there. You can also move it anywhere - just like any window.
How to pin?
Just hover over a variable, or select the variable/expression. Then click the
pinning button on right of tooltip. The DataTip is added!
The DataTip may be:
- Pinned to Source
- Unpinned from source
If Pinned to Source, the DataTip would appear only if code (program) goes to relevant function/block. It will not appear otherwise.
The DataTip would always appear, if not pinned to source.
To
Pin to Source, just click on variable/expression, right click and select 'Pin to Source'.
I cannot quite understand (as of now), how VS selects Source-pinning/unpinning of we add it by hovering and adding. Sometimes it Pins to source, sometime it doesnt.
But in both approaches, the DataTip appears as floating content. You can change the source-pinning behavior by clicking the middle of the DataTip shown.