2

使用 Kaxaml,从左侧调整大小按预期工作。

<Page
  xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
  xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
  <Grid>  

  <Grid HorizontalAlignment="Left">
    <Grid.ColumnDefinitions>
      <ColumnDefinition Width="Auto"></ColumnDefinition>
      <ColumnDefinition Width="Auto"></ColumnDefinition>
      <ColumnDefinition Width="Auto"></ColumnDefinition>
    </Grid.ColumnDefinitions>


    <GridSplitter Grid.Column="1" Width="5" Background="DarkGray" HorizontalAlignment="Right"></GridSplitter>

    <Rectangle Grid.Column="0" Fill="Red" Height="100"/>
    <Rectangle Grid.Column="1" Fill="Yellow" Height="100"/>
    <Rectangle Grid.Column="2" Fill="Green" Height="100"/>
  </Grid>

  </Grid>
</Page>

然而,当在右边尝试类似的东西时,它的行为非常不同。

<Page
  xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
  xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
  <Grid>  

  <Grid HorizontalAlignment="Right">
    <Grid.ColumnDefinitions>
      <ColumnDefinition Width="Auto"></ColumnDefinition>
      <ColumnDefinition Width="Auto"></ColumnDefinition>
      <ColumnDefinition Width="Auto"></ColumnDefinition>
    </Grid.ColumnDefinitions>


    <GridSplitter Grid.Column="1"  Width="5" Background="DarkGray" HorizontalAlignment="Left"></GridSplitter>

    <Rectangle Grid.Column="0" Fill="Red" Height="100"/>
    <Rectangle Grid.Column="1" Fill="Yellow" Height="100"/>
    <Rectangle Grid.Column="2" Fill="Green" Height="100"/>
  </Grid>

  </Grid>
</Page>

奇怪的是,只有拖动正确的作品,并且大小以几乎相反的方式发生。

4

1 回答 1

0

将第一列更改Width="*"Width="Auto"

于 2014-01-02T15:08:26.427 回答