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 に答える