开发者

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

开发者 https://www.devze.com 2023-01-21 10:19 出处:网络
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 outsid

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...

0

精彩评论

暂无评论...
验证码 换一张
取 消