We have a WPF executable that creates a and then dynamically loads several assemblies. Each assembly represents a screen (.xaml) that is displayed in one of the tabs. The Problem is that the is right under the and not at the bottom of the window. How do I force the to always be at the bottom of the window? Thx!
UserControl
DockPanel
CheckBox
StatusBar
DockPanel
UserControl
In addition to ArsenMkrt's answer about including the DockPanel.Dock="Bottom" attribute, don't forget that the LAST element in a DockPanel will fill the area unless you explicitly tell it otherwise using a height command (regardless of the DockPanel.Dock attribute provided).
my suggestion is to do thus:
<UserControl>
<DockPanel>
<StatusBar DockPanel.Dock="Bottom" />
<CheckBox />
</DockPanel>
</Usercontrol>
I had the same problem just now. Thanks to Stephen Wrighton's tip that the last element added to a DockPanel
fills the area left over, I figured out how to set up my Window
. It was a bit weird since I added the Grid
last but it was positioned in the middle.
<Window>
<DockPanel>
<Menu DockPanel.Dock="Top">
<MenuItem Header="_File">
</MenuItem>
</Menu>
<StatusBar DockPanel.Dock="Bottom">
<StatusBarItem Content="Filler" />
</StatusBar>
<Grid x:Name="rootGrid">
</Grid>
</DockPanel>
</Window>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With