CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2
  1. #1
    Join Date
    Apr 2009
    Ottawa, ON, Canada

    DrawFocusRectangle in WPF?

    What is the equivalent of ControlPaint.DrawFocusRectangle in WPF, particularly for a Canvas?

    Thank you in advance.

  2. #2
    Join Date
    Jan 2010

    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.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Windows Mobile Development Center

Click Here to Expand Forum to Full Width

On-Demand Webinars (sponsored)

By using this site, you agree to the Privacy Policy