填充数据网格后状态栏消失

问题描述 投票:0回答:1

我有包含datagrid的用户控件。一旦网格填充,我的状态栏就会消失,即使我有足够的边距并且底部有空白空间。我究竟做错了什么????

<DockPanel VerticalAlignment="Stretch" LastChildFill="False">

    <StackPanel Orientation="Horizontal" DockPanel.Dock="Top" Margin="0,0,0,0">


        <controls:ucXXXXSummary  x:Name="ucSummary"  Margin="20,20,20,30" Height="Auto" Width="Auto"/>

     <controls:XXXXUC x:Name="ucXXXX"  Margin="20,20,20,30" Height="Auto" Width="Auto"/>
    </StackPanel>


    <StatusBar DockPanel.Dock="Bottom" Height="25">
        <StatusBarItem>
            <StatusBarItem>
                <TextBlock Name="lblStatus" Text="abc!!!!!!!!!!!"/>
            </StatusBarItem>
        </StatusBarItem>
    </StatusBar>

</DockPanel>
wpf datagrid statusbar hidden status
1个回答
1
投票

不要依赖边距来相对于彼此定位元素。使用适当的Panel,例如Grid

<Grid>
    <Grid.RowDefinitions>
        <RowDefinition Height="*" />
        <RowDefinition Height="*" />
        <RowDefinition Height="Auto" />
    </Grid.RowDefinitions>
    <controls:ucXXXXSummary  x:Name="ucSummary" Margin="20,20,20,30" />
    <controls:XXXXUC Grid.Row="1" x:Name="ucXXXX"  Margin="20,20,20,30" />
    <StatusBar Grid.Row="2" Height="25">
        <StatusBarItem>
            <StatusBarItem>
                <TextBlock Name="lblStatus" Text="abc!!!!!!!!!!!"/>
            </StatusBarItem>
        </StatusBarItem>
    </StatusBar>
</Grid>

StackPanels在可滚动内容方面表现不佳:Horizontal scroll for stackpanel doesn't work

© www.soinside.com 2019 - 2024. All rights reserved.