Quantcast
Channel: Windows Presentation Foundation (WPF) forum
Viewing all articles
Browse latest Browse all 18858

Why is my dockpanel's LastChild overflowing its container?

$
0
0

I have a DockPanel with LastChildFill = true. It has 4 children: a StackPanel(top), another DockPanel(top), and three more StackPanels(bottom, left & none respectively). The last StackPanel ("ResultsPanel") has no DockPanel.Dock property set, nor does it have a width/height, yet when the databinding results in more rows than fit on the screen, it continues down behind the bottom-docked StackPanel. I would expect it to fill the center "hole" that I left between the other docked children.

If I leave the ScrollBarVisibilities set to Auto, it doesn't even show them. Any advice would be appreciated. Here is the pertinent code:

  <DockPanel Name="JobsDock" LastChildFill="True">
    <StackPanel DockPanel.Dock="Top" Height="40" Orientation="Horizontal" Background="DimGray"  >
        <Label Content="Search all jobs"  Foreground="#FF688795" FontWeight="Bold" FontFamily="Raavi" FontStretch="Normal" FontSize="18" />
        <Border CornerRadius="5" Width="90" Height="25" Background="#FF688795" HorizontalAlignment="Right" >
            <Label Content="Classic View" Foreground="White" FontSize="10" FontWeight="Bold" HorizontalAlignment="Center"></Label>
        </Border>
    </StackPanel>
    <DockPanel DockPanel.Dock="Top" Height="70" Name="SearchJobsPanel" >
        <ComboBox Name="SearchOptionComboBox" VerticalAlignment="Bottom" Width="240" Margin="5,0,5,5" ItemsSource="{Binding Path=AvailableSearchOptions}" SelectedItem="{Binding Path=SelectedSearchOption}" SelectionChanged="SearchOptionComboBox_SelectionChanged" />
        <StackPanel Height="50" Name="JobPanel" Width="90" Visibility="Collapsed" VerticalAlignment="Bottom"  Margin="5,0,5,3">
            <Label Content="Job Number" HorizontalAlignment="Center" />
            <TextBox Name="JobTextBox" Text="{Binding Path=SelectedJob, UpdateSourceTrigger=PropertyChanged}"   PreviewKeyUp="TextBox_PreviewKeyUp"/>
        </StackPanel>  
        <StackPanel VerticalAlignment="Bottom" HorizontalAlignment="Right" Margin="0,0,50,5">
            <Button Height="25" Name="SearchButton" Width="90" Click="SearchButton_Click">
                <StackPanel Orientation="Horizontal">
                    <Image Source="Images/binoculars.png" HorizontalAlignment="Center" Stretch="Fill" VerticalAlignment="Top" Margin="0,0,5,0" />
                    <Label Content="Search" FontSize="10" VerticalContentAlignment="Top" HorizontalContentAlignment="Stretch" Padding="0" />
                </StackPanel>
            </Button>
       </StackPanel>
    </DockPanel>
    <StackPanel  Name="FiltersPanel" DockPanel.Dock="Left" Width="120" Opacity="0" Background="#FF688795">
        <StackPanel Orientation="Horizontal" HorizontalAlignment="Center">
            <Button Name="ResetFilterButton" Background="{x:Null}" ToolTip="Reset All Filters" Click="ResetFilterButton_Click">
                <Image Source="Images/ResetFilter.png" Width="30"  />
            </Button>
            <Button Name="ApplyFilterButton"  Background="{x:Null}" ToolTip="Apply Filters" Margin="15,0,0,0" Click="ApplyFilterButton_Click">
                <Image Source="Images/FilterData.png" Width="30"  />
            </Button>                   
        </StackPanel>
        <Label Name="ProjectsLabel" Content="Projects" Foreground="White" Style="{StaticResource FilterButton}" />
        <Label Name="TasksLabel" Content="Tasks" Foreground="White" Style="{StaticResource FilterButton}" Margin="0,10,0,0" />
    </StackPanel>
    <StackPanel Name="ResultsPanel" Opacity="0">
        <ListView x:Name="DisplayedJobListView" ScrollViewer.VerticalScrollBarVisibility="Visible" ScrollViewer.HorizontalScrollBarVisibility="Auto" >
            <ListView.View>
                <GridView>
                    <GridViewColumn Header="Project" DisplayMemberBinding="{Binding PROJECT}" />
                    <GridViewColumn Header="Task" DisplayMemberBinding="{Binding TASK_NUMBER}" />
                    <GridViewColumn Header="Job" DisplayMemberBinding="{Binding JOBNUMBER}" />
                    <GridViewColumn Header="Part" DisplayMemberBinding="{Binding PARTNUMBER}" />
                    <GridViewColumn Header="Org" DisplayMemberBinding="{Binding ORGID}" />
                </GridView>
            </ListView.View>
        </ListView>
    </StackPanel>
</DockPanel>


Viewing all articles
Browse latest Browse all 18858

Trending Articles