Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I highlight/outline a Visual object in WPF?

Tags:

wpf

If I had a Canvas with n number of Visual objects of any shape or size, how would I highlight/outline a Visual object programmatically?

Is there something built into WPF to help me?

like image 535
Dylan Avatar asked Oct 09 '08 19:10

Dylan


1 Answers

Having read the comments in the other answer -- in which you state that you wish the outline to conform to the shape of the visual -- I can only suggest you take a look at the BitmapEffects. There is one for an Outer Glow effect.

Duplicating the visuals themselves would probably be less efficient, and would probably produce a great number of complications due to other aspects of those items, such as any bindings.

Edit: In .NET 4.0, BitmapEffects property and the BitmapEffect class are obsolete. You'll get an exception thrown. Instead, you now have the System.Windows.Media.Effects.Effect class and its derived classes, along with properties such as Visual.VisualEffect.

like image 107
Joel B Fant Avatar answered Oct 20 '22 10:10

Joel B Fant