【问题标题】:Windows Phone 8 more Items in column - row as templateWindows Phone 8 更多列中的项目 - 行作为模板
【发布时间】:2014-05-05 10:06:13
【问题描述】:

我是 Windows Phone 8 开发的新手,我想创建一个页面,其中包含在第一行 - 四列和第二行 - 一列中排序的任意数量的项目,如图所示。

谢谢!!

【问题讨论】:

    标签: c# windows-phone-7 windows-phone-8 wrappanel


    【解决方案1】:

    你可以做如下的事情

    <Grid>
        <Grid.RowDefinitions>
            <RowDefinition Height="*"/> //relative Heigts, can change them suitable to requirement
            <RowDefinition Height="7*"/>
        </Grid.RowDefinitions>
        <Grid Grid.Row=0>
            <Grid.ColumnDefnitions>
            //for equal columns
                 <ColumnDefnition width="*"/>
                 <ColumnDefnition width="*"/>
                 <ColumnDefnition width="*"/>
                 <ColumnDefnition width="*"/>
            </Grid.ColumnDefnitions>
        </Grid>
        //put all your items based on row and column.
    </Grid>
    

    【讨论】:

      【解决方案2】:

      在此代码中Grid.Row="0"Grid.Column="0" 可以省略,我写它们只是为了了解它是如何工作的。

      <Grid>
          <Grid.RowDefinitions>
              <RowDefinition />
              <RowDefinition />
              <RowDefinition Height="*"/>
          </Grid.RowDefinitions>
          <Grid.ColumnDefinitions>
              <ColumnDefinition />
              <ColumnDefinition />
              <ColumnDefinition />
              <ColumnDefinition />
          </Grid.ColumnDefinitions>
          <GreenItem Grid.Row="0" Grid.Column="0"/>
          <BlueItem Grid.Row="0" Grid.Column="1"/>
          <RedItem Grid.Row="0" Grid.Column="2"/>
          <OrangeItem Grid.Row="0" Grid.Column="3"/>
          <YellowItem Grid.Row="1" Grid.ColumnSpan="4"/>
      </Grid>
      

      【讨论】:

        【解决方案3】:

        阅读一些有关 Windows Phone 布局的信息,您会说什么?我强烈建议您阅读有关 WP Layout 的官方参考资料,然后如果出现问题,请来这里询问。

        参考:

        1. Windows Phone Layout
        2. Layout and Events
        3. 为什么不这样:Beginners Layout

        【讨论】:

          猜你喜欢
          • 1970-01-01
          • 1970-01-01
          • 2013-01-25
          • 1970-01-01
          • 1970-01-01
          • 1970-01-01
          • 1970-01-01
          • 2013-11-08
          • 2013-09-23
          相关资源
          最近更新 更多