【问题标题】:Full Justify the contents of a Wrap Panel?完全证明包装面板的内容?
【发布时间】:2013-02-12 02:09:45
【问题描述】:

如果你把它放到 Kaxaml 中:

<WrapPanel Width="500"
           ScrollViewer.VerticalScrollBarVisibility="Visible">
  <Button Width="110"
          Height="100"></Button>
  <Button Width="130"
          Height="100"></Button>
  <Button Width="70"
          Height="100"></Button>
  <Button Width="50"
          Height="100"></Button>
  <Button Width="329"
          Height="100"></Button>
  <Button Width="126"
          Height="100"></Button>
  <Button Width="86"
          Height="100"></Button>
  <Button Width="48"
          Height="100"></Button>
  <Button Width="200"
          Height="100"></Button>
  <Button Width="190"
          Height="100"></Button>
</WrapPanel>

您会看到一堆按钮与参差不齐的右侧对齐(但左侧对齐)。

有没有办法让每个“行”的内容按比例扩展以填充该行?(所以左右两边都会有直线?)

【问题讨论】:

    标签: .net wpf xaml wrappanel


    【解决方案1】:

    WrapPanel 本身并非如此,因为您所看到的正是它的设计目的。您当然可以编写自己的 Panel 来做到这一点,但我认为 TabPanel(用于布置 TabControl 选项卡的默认设置)可以满足您的要求。

    【讨论】:

    • 这太完美了!我不知道有一个 TabPanel;它确实符合原始问题的要求。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2016-06-19
    • 1970-01-01
    • 2021-08-13
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多