UniformGrid - Building a Column-Major UniformGrid in WPF(调整Item方向)

http://blogs.claritycon.com/blog/2008/11/building-a-column-major-uniformgrid-in-wpf/

By default, UniformGrid displays it's children as follows:

1 2 3 

4 5 6

7 8 9

I want to be as follows:

1 4 7 

2 5 8

3 6 9

----------------------------------------------------

   1:  <UniformGrid Rows="2" Columns="4">
   2:      <UniformGrid.LayoutTransform>
   3:          <TransformGroup>
   4:              <RotateTransform Angle="90"/>
   5:              <ScaleTransform ScaleX="-1"/>
   6:          </TransformGroup>
   7:      </UniformGrid.LayoutTransform>
   8:      <Button Background="White" Content="1"/>
   9:      <Button Background="Red" Content="2" Foreground="White"/>
  10:      <Button Background="Orange" Content="3"/>
  11:      <Button Background="Yellow" Content="4"/>
  12:      <Button Background="Green" Content="5" Foreground="White"/>
  13:      <Button Background="Blue" Content="6" Foreground="White"/>
  14:      <Button Background="Violet" Content="7"/>
  15:      <Button Background="Black" Content="8" Foreground="White"/>
  16:  </UniformGrid>

AND

 

   1:  <Style TargetType="Button">
   2:      <Setter Property="LayoutTransform">
   3:          <Setter.Value>
   4:              <TransformGroup>
   5:                  <RotateTransform Angle="-90"/>
   6:                  <ScaleTransform ScaleY="-1"/>
   7:              </TransformGroup>
   8:          </Setter.Value>
   9:      </Setter>
  10:  </Style>

转载于:https://www.cnblogs.com/rock_chen/archive/2012/12/08/2809375.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值