代码之家  ›  专栏  ›  技术社区  ›  Kishore Kumar

有没有什么方法可以像网格一样在画布上自动地水平或垂直地拉伸孩子们?

  •  0
  • Kishore Kumar  · 技术社区  · 16 年前

    如果我们给水平和垂直对齐属性来拉伸,是否有任何方法可以拉伸放置在Convas中的元素?

    1 回复  |  直到 13 年前
        1
  •  0
  •   Adel Hazzah    16 年前

    <Window x:Class="WpfApplication1.Window1"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        Title="Window1" Height="300" Width="300">
        <Canvas Name="theCanvas">
            <Button Content="Hello" Width="{Binding ActualWidth, ElementName=theCanvas}" />
        </Canvas>
    </Window>
    
    推荐文章