How can I ensure that WPF UserControl elements are visible outside the bounds of the control? – Education Career Blog

I have a UserControl containing interactive elements within a grid. The user can move and resize these elements, often causing them to fall outside the bounds of my control. When elements do fall outside, I don’t want them to clip. I want them to be visible no matter what. Unfortunately, setting ClipToBounds to FALSE did not solve the problem.

Even in the past during a similar situation, I had used ClipToBounds, and while it appeared to work at first, I noticed that out-of-bounds elements occasionally disappeared when dragged to certain locations. There didn’t seem to be a logical explanation as to why they disappeared except that perhaps the layout system was out-prioritizing ClipToBounds being set to false, only at certain locations.

It was very annoying and my work-around involved programmatically resizing my UserControl constantly to encase all inner elements, which seems to be a very bad approach. Is there a cleaner way to ensure that my elements are always visible outside the bounds of my control (preferably without using ClipToBounds – is there a property I’m missing here)? Any help is greatly appreciated.

,

AFIK Canvas do not clip…

Leave a Comment