WPF DockPanel Menu and Status Panel

Saturday, April 25 2009 -

Going through the forums today I found a small post where a user was having trouble with the DockPanel, Menu, and a StatusBar. The Developer was trying to add a Menu to the top of the application and a Status Bar to the bottom, but what was happening was that the Status bar was appearing in the Centre of the application.

Reading through the post I found out about the LastChildFill property for the DockPanel, What this does is it sets the last item in the dock panels child collection to fill in the remainder of the Dock Panel. This is also set on by default.

To fix this the developer could set the property to false or just add another control to the last of the stack. I have put together a simple Application that does this…

Here is the XAML for the project.

<Window x:Class="MenuStatusTest.Window1"
    xmlns
="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x
="http://schemas.microsoft.com/winfx/2006/xaml"
    Title
="Window1" Height="300" Width="300">
       
<DockPanel Name="dockPanel1">
           
<Menu DockPanel.Dock="Top" Height="22" Name="menu1"/>
            <
StatusBar DockPanel.Dock="Bottom" Height="23" Name="statusBar1"/>
            <
Grid ></Grid>
       
</DockPanel>
</Window>

All the above code does is add a dock panel, menu bar, and status bar to the application. But it also adds the default grid control to the centre of the application window.

kick it on DotNetKicks.com kick it on gamedevkicks.com

Similar Posts

  1. WPF Interface Design - GridSplitter
  2. WPF Timer with Progress Bars
  3. Phoenix, Drawing Text on the Screen

1 comment(s)

Clicky Web Analytics