是否可以将多个控件添加到另一个控件 [英] Is it possible to add more than one control to another

查看:102
本文介绍了是否可以将多个控件添加到另一个控件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想使用ScrollViewer控件滚动多个文本框,其中包含信息,但是当我将文本框拖到滚动查看器中时,它只允许你有一个文本框。有没有办法解决这个问题,如果没有,有什么方法可以做我想要的

I want to use a ScrollViewer control to scroll through multiple textboxes with information in them, however when I drag a textbox into the scrollviewer it only lets you have one in it. Is there a way around this, and if not is there any way to do what I want it to?

推荐答案

你需要有面板派生项作为scrollviewer中的第一件事。某些元素(通常是非面板)只允许一个孩子,例如边框,按钮,滚动查看器。其他元素(通常是面板派生的项目)允许多个孩子,
的例子是网格,画布和堆叠面板。

You need to have a panel derived item as the first thing in the scrollviewer. Certain elements (non-panels generally) only allow one child, examples are border, button, scrollviewer. Other elements (generally panel derived items) allow multiple children, examples are grid, canvas, and stackpanel.

因此,根据你想要的孩子布局,放一个画布, grid或stackpanel作为scrollviewer中的第一项,并将所有子项添加到该项(canvas,grid或stackpanel)。

So depending how you want the children laid out, put a canvas, grid or stackpanel as the first item in your scrollviewer, and add all the children to that one (canvas, grid or stackpanel).


这篇关于是否可以将多个控件添加到另一个控件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆