WPF Fill Window

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Bill McCormick

    WPF Fill Window

    How can I make a control (panel, grid, dock) fill an entire window other
    than setting height/width properties?
  • Andy

    #2
    Re: WPF Fill Window

    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...@ne wsgroup.nospam>
    wrote:
    How can I make a control (panel, grid, dock) fill an entire window other
    than setting height/width properties?

    Comment

    • Bill McCormick

      #3
      Re: WPF Fill Window

      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...@ne wsgroup.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?

      Comment

      • Andy

        #4
        Re: WPF Fill Window

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

        Try this:

        <Window x:Class="WpfApp lication9.Windo w1"
        xmlns="http://schemas.microso ft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microso ft.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...@ne wsgroup.nospam>
        wrote:
        Right, that's what I'm trying to do. But what properties tell the Dock
        panel to *Fill* the Window?

        Comment

        • Bill McCormick

          #5
          Re: WPF Fill Window

          <Window x:Class="WpfApp lication1.Windo w1"
          xmlns="http://schemas.microso ft.com/winfx/2006/xaml/presentation"
          xmlns:x="http://schemas.microso ft.com/winfx/2006/xaml"
          Title="ScTech" Height="300" Width="300">
          <DockPanel Name="dockPanel 1" HorizontalAlign ment="Center"
          VerticalAlignme nt="Center" Background="Ali ceBlue"
          Grid.IsSharedSi zeScope="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="WpfApp lication9.Windo w1"
          xmlns="http://schemas.microso ft.com/winfx/2006/xaml/presentation"
          xmlns:x="http://schemas.microso ft.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...@ne wsgroup.nospam>
          wrote:
          >Right, that's what I'm trying to do. But what properties tell the Dock
          >panel to *Fill* the Window?
          >

          Comment

          • Andy

            #6
            Re: WPF Fill Window

            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.IsSharedSi zeScope 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...@ne wsgroup.nospam>
            wrote:
            <Window x:Class="WpfApp lication1.Windo w1"
                 xmlns="http://schemas.microso ft.com/winfx/2006/xaml/presentation"
                 xmlns:x="http://schemas.microso ft.com/winfx/2006/xaml"
                 Title="ScTech" Height="300" Width="300">
                 <DockPanel Name="dockPanel 1" HorizontalAlign ment="Center"
            VerticalAlignme nt="Center" Background="Ali ceBlue"
            Grid.IsSharedSi zeScope="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?

            Comment

            • Bill McCormick

              #7
              Re: WPF Fill Window

              Hold the phone, I got it:

              <DockPanel Name="dockPanel 1" Height="Auto" Width="Auto"
              LastChildFill=" False" HorizontalAlign ment="Stretch"
              VerticalAlignme nt="Stretch" />

              Thanks for trying.


              Bill

              Bill McCormick wrote:
              <Window x:Class="WpfApp lication1.Windo w1"
              xmlns="http://schemas.microso ft.com/winfx/2006/xaml/presentation"
              xmlns:x="http://schemas.microso ft.com/winfx/2006/xaml"
              Title="ScTech" Height="300" Width="300">
              <DockPanel Name="dockPanel 1" HorizontalAlign ment="Center"
              VerticalAlignme nt="Center" Background="Ali ceBlue"
              Grid.IsSharedSi zeScope="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="WpfApp lication9.Windo w1"
              > xmlns="http://schemas.microso ft.com/winfx/2006/xaml/presentation"
              > xmlns:x="http://schemas.microso ft.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...@ne wsgroup.nospam>
              >wrote:
              >>Right, that's what I'm trying to do. But what properties tell the Dock
              >>panel to *Fill* the Window?
              >>

              Comment

              Working...