简体   繁体   English

多列滚动,可调整大小的面板?

[英]Multiple column scrolling, resizeable panel?

I have this: 我有这个:

可滚动面板

Each list is its own WrapPanel and they are all on another WrapPanel which is in a ScrollViewer . 每个列表都是其自己的WrapPanel ,它们都位于ScrollViewer另一个WrapPanel上。 If I don't set the height myself for the main WrapPanel it assumes I want the WrapPanel as high as it can go giving me only one column whereas I want as many columns as needed to fill the window. 如果我自己没有为主WrapPanel设置高度,它会假设我希望WrapPanel尽可能高,只给我一栏,而我想要的栏数却足够填满窗口。

If I set the Width and Height of the WrapPanel that holds everything to fixed numbers, but I want it to change when the user resizes the window. 如果我将WrapPanelWidthHeight设置为将所有内容固定为固定数字,但是我希望在用户调整窗口大小时更改它。

In your example screen shot and description I see a tab control whose anchor is set to Top, Left, Bottom, and Right. 在您的示例屏幕快照和说明中,我看到一个选项卡控件,其锚点设置为“上”,“左”,“下”和“右”。 The tab page with AutoScroll set to true. 自动滚动设置为true的选项卡页面。 Within the tab page I see a FlowLayoutPanel. 在选项卡页面中,我看到了FlowLayoutPanel。 The FlowLayoutPanel has its AutoSize property set to true. FlowLayoutPanel的AutoSize属性设置为true。 I also see a set of other panels/user controls each of which contains a title and a series of check boxes. 我还看到了一组其他面板/用户控件,每个面板都包含一个标题和一系列复选框。

You can`t achieve this with standard controls. 您无法使用标准控件来实现这一目标。 You can try to create your own custom WrapPanel implementation. 您可以尝试创建自己的自定义WrapPanel实现。 But, actually, looking at original WrapPanel sources I think this will be quite tricky. 但是,实际上,看看原始的WrapPanel来源,我认为这将非常棘手。 You see, what you want, is basically to measure how many columns can fit in the current window, while every element in column can be of any size. 您所看到的基本上是要测量当前窗口中可以容纳多少列,而列中的每个元素可以是任意大小。 The way I see that algorithm, it will require N*N iterations to get the final result. 我看该算法的方式将需要N * N次迭代才能获得最终结果。 So you may have problems with performance. 因此,您可能会遇到性能问题。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM