代码之家  ›  专栏  ›  技术社区  ›  Chris Holmes

尝试停靠Items控件时LastChildFill不起作用

  •  1
  • Chris Holmes  · 技术社区  · 17 年前

    <Border Name="_border" BorderThickness="4" BorderBrush="Blue">
        <Canvas Name="_canvas" Background="Black" >
            <DockPanel LastChildFill="True">
                <ItemsControl Name="_itemsControl" Background="Bisque" AllowDrop="True" Height="100" Width="100"
                          HorizontalAlignment="Stretch"
                          VerticalAlignment="Stretch"
                          ItemTemplate="{StaticResource pictureTemplate}"
                          ItemsPanel="{StaticResource panelTemplate}"
                          Drop="_itemsControl_Drop" 
                          DragOver="_itemsControl_DragOver" 
                          DragLeave="_itemsControl_DragLeave" 
                          PreviewMouseLeftButtonDown="_itemsControl_PreviewMouseLeftButtonDown"
                          PreviewMouseMove="_itemsControl_PreviewMouseMove">
    
            </ItemsControl>
                 </DockPanel>
        </Canvas>
    </Border>
    

    2 回复  |  直到 14 年前
        1
  •  2
  •   foson    17 年前

        2
  •  2
  •   bendewey    17 年前

    你的DockPanel有多大?尝试在DockPanel上设置测试背景。

    我不认为你的问题是你的Items控件没有拉伸到填充DockPanel,但实际上你的DockPanel没有拉伸到适合Canvas控件内部。画布控件及其子控件将不会调整大小以适应其父控件。