views:

22

answers:

1

Here's my layout.

<Window>
 <StackPanel Orientation="Vertical">
       <StackPanel HorizontalAlignment="Stretch" Height="30">
       </StackPanel>
       <Canvas HorizontalAlignment="Center" Width="1020">
                    <!--i want this to take the remaining full height of the screen-->
                    <Canvas x:Name="bottomInfoBar" Canvas.Bottom="0" Width="720" Height="39">
                    <!--I want this at the very bottom of the screen-->
                    </Canvas>
       </Canvas>
</Window>

I want the canvas to take the full height of the window so that the 'bottomInfoBar' always remains at the very bottom of the user's screen. However if i don't specify a height for the canvas 'bottomInfoBar' appears at the very top. How do i achieve this? Please help.

+2  A: 

Easiest way:

<Window>
    <DockPanel>
        <Whatever x:Name="bottomInfoBar" DockPanel.Dock="Bottom"/>

        <PrimaryContent/>
    </DockPanel>
</Window>

Based on your question, you really should read about WPF's layout system before you write another line of code. You'll save yourself a world of pain if you understand that before proceeding.

HTH,
Kent

Kent Boogaart
You are right but i need to have the 'bottomInfoBar' inside the canvas for a specific reason. Would it be impossible?
smkngspcmn
I guess my point is that your specific reason may turn out to be irrelevant if a deeper understanding of the layout system is first acquired. That said, nothing stops you from hosting a `Canvas` inside the control that is docked to bottom.
Kent Boogaart
My specific reason was that i needed to animate the 'bottomInfoBar' increase height over the primary content. If i take it out and put it before the primary content and dock it to the bottom it animates but behind the primary content. If i put it after the primary content it doesnt animate at all. Sorry i know i'm pretty clueless about WPF positioning.
smkngspcmn
Sounds like a job for `Panel.ZIndex` - but you would know that if you read about the layout system ;)
Kent Boogaart
Great! Reading now.
smkngspcmn