将 ScrollViewer 附加到 FrameworkElement?

发布于 2024-10-02 02:56:34 字数 163 浏览 0 评论 0原文

是否可以使用Adorner或其他方式动态获取UIElement/FrameworkElement并将其放置在动态创建的ScrollViwer中?我知道明显的问题是您必须首先将元素与其父元素分离,但我正在寻找一种优雅的方法来执行此操作。

Is it possible, using an Adorner or other means, to dynamically take a UIElement/FrameworkElement and place it within a dynamically created ScrollViwer? I know that the obvious problem will be that you have to detach the element from it's parent element first, but I am looking for an elegant way of doing this.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

绾颜 2024-10-09 02:56:34

如果您的元素不必是交互式的,您可以只使用 VisualBrush。如果它实际上必须从一个地方移动到另一个地方并继续照常工作,您将必须复制您的控件或附加/分离它。

据我所知,没有“优雅”的方法可以做到这一点 - 您必须通过正常的方式,例如 Children.Remove/Add (如果其父级是面板)等。

If your element doesn't have to be interactive you can just use a VisualBrush. If it has to actually move from one place to the other and keep working as usual you'll have to either duplicate your control or attach/detach it.

To my knowledge there's no "elegant" way of doing this - you'll have to go through normal means, such as Children.Remove/Add (if its parent is a panel), etc.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文