August 14th, 2011, 10:39 AM
DrawFocusRectangle in WPF?
What is the equivalent of ControlPaint.DrawFocusRectangle in WPF, particularly for a Canvas?
Thank you in advance.
August 17th, 2011, 06:16 PM
Re: DrawFocusRectangle in WPF?
Hi. Just a quick tip - sort of speaking off of the top of my head here, would need to check the docs for the actual details, but:
Most of the WPF elements implement the Decorator pattern - this basically means that elements and their decorations (like borders, for example) stack on top of each others almost like layers in Photoshop, and forward user events where appropriate.
Focus rectangle is just a simple rectangle drawn on top of a WinForms "canvas". In the WPF, you don't have the single "canvas" concept in the same sense, but you specify the structure that forms the visual tree, that the system later uses to do the actual rendering. It's almost like lego
So in essence, you just need a border. IIRC, WPF is setup so that the border contains the thing that it borders, so you should be able to figure out something. And you can style that border anyway you like.
Click Here to Expand Forum to Full Width