By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
432,462 Members | 799 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 432,462 IT Pros & Developers. It's quick & easy.

WPF Fill Window

P: n/a
How can I make a control (panel, grid, dock) fill an entire window other
than setting height/width properties?
Nov 19 '08 #1
Share this Question
Share on Google+
6 Replies


P: n/a
Well, one way would be to add a Dockpanel to the window, and put the
content in that.

On Nov 19, 12:59*pm, Bill McCormick <wpmccorm...@newsgroup.nospam>
wrote:
How can I make a control (panel, grid, dock) fill an entire window other
than setting height/width properties?
Nov 19 '08 #2

P: n/a
Andy wrote:
Well, one way would be to add a Dockpanel to the window, and put the
content in that.

On Nov 19, 12:59 pm, Bill McCormick <wpmccorm...@newsgroup.nospam>
wrote:
>How can I make a control (panel, grid, dock) fill an entire window other
than setting height/width properties?
Right, that's what I'm trying to do. But what properties tell the Dock
panel to *Fill* the Window?
Nov 19 '08 #3

P: n/a
The DockPanel should fill the window on its own, unless you've set a
Height or Width.

Try this:

<Window x:Class="WpfApplication9.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>
<Button />
</DockPanel>
</Window>

For me, that creates a button which fills the window, even as you
resize.

On Nov 19, 3:48*pm, Bill McCormick <wpmccorm...@newsgroup.nospam>
wrote:
Right, that's what I'm trying to do. But what properties tell the Dock
panel to *Fill* the Window?
Nov 19 '08 #4

P: n/a
<Window x:Class="WpfApplication1.Window1"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="ScTech" Height="300" Width="300">
<DockPanel Name="dockPanel1" HorizontalAlignment="Center"
VerticalAlignment="Center" Background="AliceBlue"
Grid.IsSharedSizeScope="False">
<Button/>
</DockPanel>
</Window>

Produces a tiny little button. Maybe I'm looking for something that
doesn't exist in WPF because it's not necessary?

Andy wrote:
The DockPanel should fill the window on its own, unless you've set a
Height or Width.

Try this:

<Window x:Class="WpfApplication9.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>
<Button />
</DockPanel>
</Window>

For me, that creates a button which fills the window, even as you
resize.

On Nov 19, 3:48 pm, Bill McCormick <wpmccorm...@newsgroup.nospam>
wrote:
>Right, that's what I'm trying to do. But what properties tell the Dock
panel to *Fill* the Window?
Nov 19 '08 #5

P: n/a
I'd axe all the properties you set on the DockPanel, except for the
Name. At the very least, I don't know why you have
Grid.IsSharedSizeScope set at all, since there's no grid on your
window.

What are you trying to do?

On Nov 19, 4:13*pm, Bill McCormick <wpmccorm...@newsgroup.nospam>
wrote:
<Window x:Class="WpfApplication1.Window1"
* * *xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
* * *xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
* * *Title="ScTech" Height="300" Width="300">
* * *<DockPanel Name="dockPanel1" HorizontalAlignment="Center"
VerticalAlignment="Center" Background="AliceBlue"
Grid.IsSharedSizeScope="False">
* * * * *<Button/>
* * *</DockPanel>
</Window>

Produces a tiny little button. Maybe I'm looking for something that
doesn't exist in WPF because it's not necessary?
Nov 19 '08 #6

P: n/a
Hold the phone, I got it:

<DockPanel Name="dockPanel1" Height="Auto" Width="Auto"
LastChildFill="False" HorizontalAlignment="Stretch"
VerticalAlignment="Stretch" />

Thanks for trying.
Bill

Bill McCormick wrote:
<Window x:Class="WpfApplication1.Window1"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="ScTech" Height="300" Width="300">
<DockPanel Name="dockPanel1" HorizontalAlignment="Center"
VerticalAlignment="Center" Background="AliceBlue"
Grid.IsSharedSizeScope="False">
<Button/>
</DockPanel>
</Window>

Produces a tiny little button. Maybe I'm looking for something that
doesn't exist in WPF because it's not necessary?

Andy wrote:
>The DockPanel should fill the window on its own, unless you've set a
Height or Width.

Try this:

<Window x:Class="WpfApplication9.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>
<Button />
</DockPanel>
</Window>

For me, that creates a button which fills the window, even as you
resize.

On Nov 19, 3:48 pm, Bill McCormick <wpmccorm...@newsgroup.nospam>
wrote:
>>Right, that's what I'm trying to do. But what properties tell the Dock
panel to *Fill* the Window?
Nov 19 '08 #7

This discussion thread is closed

Replies have been disabled for this discussion.