zoukankan      html  css  js  c++  java
  • WPF布局(5) 使用共享尺寸组布局

    设置列ColumnDefinition 属性中的 SharedSizeGroup ,SharedSizeGroup的值相同时,可以控制一个Grid中的列和另外一个Gird中的某一列的宽度相同。
    还有一个要注意的是 顶级Grid元素的IsSharedSizeScope要设置为True
       
     <Grid Grid.IsSharedSizeScope="True" Margin="3" ShowGridLines="True">
    <Grid.RowDefinitions>
    <RowDefinition></RowDefinition>
    <RowDefinition Height="Auto"></RowDefinition>
    <RowDefinition></RowDefinition>
    </Grid.RowDefinitions>
    <Grid Grid.Row="0" Margin="3" Background="LightYellow" ShowGridLines="True">
    <Grid.ColumnDefinitions >
    <ColumnDefinition Width="Auto" SharedSizeGroup="TextLabel"></ColumnDefinition>
    <ColumnDefinition Width="Auto"></ColumnDefinition>
    <ColumnDefinition></ColumnDefinition>
    </Grid.ColumnDefinitions>
    <Label Margin="5">A very long bit of text</Label>
    <Label Grid.Column="1" Margin="5">More text</Label>
    <TextBox Grid.Column="2" Margin="5">A text box</TextBox>
    </Grid>
    <Label Grid.Row="1">Some text in between the two grids</Label>
    <Grid Grid.Row="2" Margin="3" Background="LightYellow" ShowGridLines="True">
    <Grid.ColumnDefinitions>
    <ColumnDefinition Width="Auto" SharedSizeGroup="TextLabel"></ColumnDefinition>
    <ColumnDefinition></ColumnDefinition>
    </Grid.ColumnDefinitions>
    <Label Margin="5">Short</Label>
    <TextBox Grid.Column="1" Margin="5">A text box</TextBox>
    </Grid>
    </Grid>
    
    



    编辑器加载中...

  • 相关阅读:
    秘密挤奶机(最大流,二分)
    伊基的故事 I
    多源汇最大流(最大流)
    无向树是二分图
    上下界可行流
    圆桌问题(最大流,二分图,网络流24题)
    双栈排序
    观光奶牛
    拜访奶牛
    愤怒的牛&数列分段II
  • 原文地址:https://www.cnblogs.com/WilliamJiang/p/2305493.html
Copyright © 2011-2022 走看看