1
votes

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"  >
    <Label />
    <Border CornerRadius="5" Width="90" Height="25" >
        <Label Content="Classic View" />
    </Border>
</StackPanel>
<DockPanel DockPanel.Dock="Top" Height="70" Name="SearchJobsPanel" >
    <ComboBox Name="SearchOptionComboBox" VerticalAlignment="Bottom" Width="240"  />
    <StackPanel Height="50" Name="JobPanel" Width="90" Visibility="Collapsed" VerticalAlignment="Bottom" >
        <Label Content="Job Number" HorizontalAlignment="Center" />
        <TextBox Name="JobTextBox" />
    </StackPanel>   
    <StackPanel VerticalAlignment="Bottom" HorizontalAlignment="Right">
        <Button Height="25" Name="SearchButton" Width="90">
            <StackPanel Orientation="Horizontal">
                <Image  Stretch="Fill" Margin="0,0,5,0" />
                <Label Content="Search" FontSize="10" VerticalContentAlignment="Top"  />
            </StackPanel>
        </Button>
   </StackPanel>
</DockPanel>
<StackPanel  Name="FiltersPanel" DockPanel.Dock="Left" Width="120" Opacity="0" >
    <StackPanel Orientation="Horizontal" HorizontalAlignment="Center">
        <Button Name="ResetFilterButton" >
            <Image Source="Images/ResetFilter.png" Width="30"  />
        </Button>
        <Button Name="ApplyFilterButton"  >
            <Image Width="30"  />
        </Button>                    
    </StackPanel>
    <Label Name="ProjectsLabel"  />
    <Label Name="TasksLabel"  Margin="0,10,0,0" />
</StackPanel>
<StackPanel Name="ResultsPanel" Opacity="0">
    <ListView x:Name="DisplayedJobListView" ScrollViewer.VerticalScrollBarVisibility="Visible" >
        <ListView.View>
            <GridView>
            </GridView>
        </ListView.View>
    </ListView>
</StackPanel>

1

1 Answers

1
votes

Jurgen, on the msdn forum answered this question for me. Here is his reply:

Hi,

the last (filling) DockPanel child is a StackPanel ("ResultsPanel"). A StackPanel's layout is never defined by containing controls (there is nothing working like VerticalLayout="Stretch" for a StackPanel). It will always take the space neccessary for it's contained controls to fully expand.

As you only have one child in that StackPanel (which has a scrolling mechanism of it's own) remove the StackPanel.

Hope this helps.

Cheers Jürgen