(Lviv community of .NET developers)

“Smart Tag” type of popup in WPF

August 26, 2007 21:00 by realnero

The other day I was searching around for examples of Office 2007 like “Smart Tag” type of popup implemented in WPF, but I could not find any with source code available. As you know that the tooltip control in WPF/XAML does not allow any controls you put inside a tooltip to receive focus or mouse click events, you have to use the primitive Popup control instead to achieve such functionality. So I decided to build one myself. It turns out the process is quite simple. The only trick that I find out and still not know how to solve elegantly is wiring up the delayed popup solely in XAML. Currently my implementation utilizes a custom service class that wires up the mouse events between the popup and the target control. The XAML part of the control is very simple:


Inside your Popup definition, you can define your Smart Tag popup as you would in any other XAML elements. The following is an example of a toolbar enclosed inside thepopup:


In order to support positioning the popup control in arbitrary location close to (but not border-to-border) its target control, you need to wire the MouseMove and MouseLeave events of both the Popup control and the target control. And you need a delayed hide/show service to ensure that the popup won’t flash if you quickly move your mouse around. This is achieved through a delayed DispatchTimer in the DelayedPopupService code.


Let me know what you think of this.

 

The source code is uploaded.

WpfSmartTagSample.zip (70,19 kb)


Currently rated 5.0 by 1 people

  • Currently 5/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5

Categories: WinFx
Actions: Permalink | Comments (17) | RSSRSS comment feed

Comments

April 17. 2010 15:16

You only have to do a very few things right in your life so long as you don't do too many things wrong

payday advance

July 5. 2010 15:35

The Big 10 Football Nation Forum is known as a site in which you possibly can examine just about something concerning the NCAA Big 10 Football Conference. You could also examine about all kinds of other issues like other NCAA Football Conferences, other sports, daily chit chat, and many other topics. There is usually a special VIP Section where you may buy, sell, trade, or have sports bets with other members. http://www.big10footballnation.net/forums/forum.php

football forum

July 7. 2010 06:40

Have to disagree with the comment above, get your details straight just before writting such a comment.

Charlie

July 7. 2010 17:43

I totally agree.

Mira Jones

July 10. 2010 14:00

The Big 10 Football Nation Forum is mostly a site in which you are able to talk about just about anything about the NCAA Big 10 Football Conference. You may possibly also examine about many other points like other NCAA Football Conferences, other sports activities, every day chit chat, and many other topics. There can be a unique VIP Section where you might acquire, sell, trade, or have sporting activities bets with other members. http://www.big10footballnation.net/forums/forum.php

big 10 conference

July 10. 2010 14:00

Trubloods.com may be a internet site specializing in providing just about every 1 of the many advantages and darkness of the struck demonstrate True Blood. True Blood is known as as the particular artificial blood vessels how the particular japoneses have got designed now vampires come out from the darkness to be able to try as well because coexist along with people today. You stick to Sookie Stackhouse since she deals making use of the actual turmoil which is out there around the world. There's love, comedy, action, and also several more when you view vampires, humans because well since supernaturals clash in the town of Bon Temperatures, Louisiana. Watch entirely free avenues from trubloods.com!

supernatural

July 12. 2010 23:52

This is actually my very first time i visit here. I discovered a lot of interesting stuff in your blog particularly it's discussion. From the tons of remarks on your articles, I suppose I am not the only one having all of the enjoyment here! keep up the good work.

dentist

July 14. 2010 21:13

Have to disagree with the comment above, get your details straight just before writting such a comment.

vibram fivefingers

July 21. 2010 22:35

http://www.coachoutletfactory.com coach outlet
http://www.coachoutletmalls.com coach factory outlet
http://www.coach-handbags-outlet.com coach handbags
by zocy002 on 2010-7-22

coach handbags

July 22. 2010 05:51

Do you accept guest posts? I would also like to have copy post here

satellite tv on computer

July 29. 2010 01:41

Just wanted to say hello from New York

name tags

August 16. 2010 04:33

Thank you for this blog. That is all I can say. You most definitely have made this blog into something that is eye opening and important. You clearly know so much about the subject, you have covered so many bases. Great stuff from this part of the internet. Again, thank you for this blog.

dentist wakefield

August 18. 2010 09:39

SPORTS BETTING World's No.1 destination for online betting, football betting, baseball betting,spread betting & horse racing betting on the internet. Online Betting made simple & secure at SPORTSBETTINGCHUMP.COM

vimal

August 18. 2010 19:17

Thank you for this awesome site.

Miss Saturday Night

August 20. 2010 03:39

Hey there from North Carolina, great post.

magnetic name badges

August 31. 2010 07:17

I suggest this site to my friends so it could be useful & informative for them also. Great effort.

send flowers to germany

September 8. 2010 04:34

very good post ! thanks for sharing!
http://www.supplynflshop.com cheap nfl jerseys

supplynflshop

Add comment


(Will show your Gravatar icon)