Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. WCF and WF
  4. DockPanel LIFO scrollable

DockPanel LIFO scrollable

Scheduled Pinned Locked Moved WCF and WF
data-structureshelp
4 Posts 4 Posters 1 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • P Offline
    P Offline
    peterotoole
    wrote on last edited by
    #1

    Hi there. I have a stack of buttons in a dockpanel because i need that the last button to get the stack to stay on the top (like LIFO). That's why DockPanel.Dock="Bottom" and LastChildFill="False". The goal is the first button (Button1) is on bottom and the last (Button5) stays on top. Like this code: <!-- <DockPanel LastChildFill="False">                   <Button Name="button1" DockPanel.Dock="Bottom">Button1</Button>                   <Button Name="button2" DockPanel.Dock="Bottom">Button2</Button>                   <Button Name="button16"DockPanel.Dock="Bottom">Button3</Button>                   <Button Name="button3" DockPanel.Dock="Bottom">Button4</Button>                   <Button Name="button4" DockPanel.Dock="Bottom">Button5</Button> </DockPanel> --> My problem starts when dynamically i insert one more button and the space available on the dockpanel is not big enough. The last button disapears (and i have no more space to get the dockpanel bigger). The problem is solved when i put a ScrollViewer and a ItemsControl. Like this: <DockPanel LastChildFill="False">             <ScrollViewer>                <ItemsControl>                   <Button Name="button1" DockPanel.Dock="Bottom">Button1</Button>                   <Button Name="button2" DockPanel.Dock="Bottom">Button2</Button>                   <Button Name="button16"DockPanel.Dock="Bottom">Button3</Button>                   <Button Name="button3" DockPanel.Dock="Bottom">Button4</Button>                   <Button Name="button4" DockPanel.Dock="Bottom">Button5</Button>                </ItemsControl>           &nb

    S R G 3 Replies Last reply
    0
    • P peterotoole

      Hi there. I have a stack of buttons in a dockpanel because i need that the last button to get the stack to stay on the top (like LIFO). That's why DockPanel.Dock="Bottom" and LastChildFill="False". The goal is the first button (Button1) is on bottom and the last (Button5) stays on top. Like this code: <!-- <DockPanel LastChildFill="False">                   <Button Name="button1" DockPanel.Dock="Bottom">Button1</Button>                   <Button Name="button2" DockPanel.Dock="Bottom">Button2</Button>                   <Button Name="button16"DockPanel.Dock="Bottom">Button3</Button>                   <Button Name="button3" DockPanel.Dock="Bottom">Button4</Button>                   <Button Name="button4" DockPanel.Dock="Bottom">Button5</Button> </DockPanel> --> My problem starts when dynamically i insert one more button and the space available on the dockpanel is not big enough. The last button disapears (and i have no more space to get the dockpanel bigger). The problem is solved when i put a ScrollViewer and a ItemsControl. Like this: <DockPanel LastChildFill="False">             <ScrollViewer>                <ItemsControl>                   <Button Name="button1" DockPanel.Dock="Bottom">Button1</Button>                   <Button Name="button2" DockPanel.Dock="Bottom">Button2</Button>                   <Button Name="button16"DockPanel.Dock="Bottom">Button3</Button>                   <Button Name="button3" DockPanel.Dock="Bottom">Button4</Button>                   <Button Name="button4" DockPanel.Dock="Bottom">Button5</Button>                </ItemsControl>           &nb

      S Offline
      S Offline
      Sacha Barber
      wrote on last edited by
      #2

      I would use a Grid, its the container of champions.

      Sacha Barber

      • Microsoft Visual C# MVP 2008/2009
      • Codeproject MVP 2008/2009

      Your best friend is you. I'm my best friend too. We share the same views, and hardly ever argue My Blog : sachabarber.net

      1 Reply Last reply
      0
      • P peterotoole

        Hi there. I have a stack of buttons in a dockpanel because i need that the last button to get the stack to stay on the top (like LIFO). That's why DockPanel.Dock="Bottom" and LastChildFill="False". The goal is the first button (Button1) is on bottom and the last (Button5) stays on top. Like this code: <!-- <DockPanel LastChildFill="False">                   <Button Name="button1" DockPanel.Dock="Bottom">Button1</Button>                   <Button Name="button2" DockPanel.Dock="Bottom">Button2</Button>                   <Button Name="button16"DockPanel.Dock="Bottom">Button3</Button>                   <Button Name="button3" DockPanel.Dock="Bottom">Button4</Button>                   <Button Name="button4" DockPanel.Dock="Bottom">Button5</Button> </DockPanel> --> My problem starts when dynamically i insert one more button and the space available on the dockpanel is not big enough. The last button disapears (and i have no more space to get the dockpanel bigger). The problem is solved when i put a ScrollViewer and a ItemsControl. Like this: <DockPanel LastChildFill="False">             <ScrollViewer>                <ItemsControl>                   <Button Name="button1" DockPanel.Dock="Bottom">Button1</Button>                   <Button Name="button2" DockPanel.Dock="Bottom">Button2</Button>                   <Button Name="button16"DockPanel.Dock="Bottom">Button3</Button>                   <Button Name="button3" DockPanel.Dock="Bottom">Button4</Button>                   <Button Name="button4" DockPanel.Dock="Bottom">Button5</Button>                </ItemsControl>           &nb

        R Offline
        R Offline
        RugbyLeague
        wrote on last edited by
        #3

        Are the DockPanel.Dock items ignored? The buttons are children of the ItemsControl which is a child of the ScrollViewer, only the ScrollViewer is a child of the DockPanel

        1 Reply Last reply
        0
        • P peterotoole

          Hi there. I have a stack of buttons in a dockpanel because i need that the last button to get the stack to stay on the top (like LIFO). That's why DockPanel.Dock="Bottom" and LastChildFill="False". The goal is the first button (Button1) is on bottom and the last (Button5) stays on top. Like this code: <!-- <DockPanel LastChildFill="False">                   <Button Name="button1" DockPanel.Dock="Bottom">Button1</Button>                   <Button Name="button2" DockPanel.Dock="Bottom">Button2</Button>                   <Button Name="button16"DockPanel.Dock="Bottom">Button3</Button>                   <Button Name="button3" DockPanel.Dock="Bottom">Button4</Button>                   <Button Name="button4" DockPanel.Dock="Bottom">Button5</Button> </DockPanel> --> My problem starts when dynamically i insert one more button and the space available on the dockpanel is not big enough. The last button disapears (and i have no more space to get the dockpanel bigger). The problem is solved when i put a ScrollViewer and a ItemsControl. Like this: <DockPanel LastChildFill="False">             <ScrollViewer>                <ItemsControl>                   <Button Name="button1" DockPanel.Dock="Bottom">Button1</Button>                   <Button Name="button2" DockPanel.Dock="Bottom">Button2</Button>                   <Button Name="button16"DockPanel.Dock="Bottom">Button3</Button>                   <Button Name="button3" DockPanel.Dock="Bottom">Button4</Button>                   <Button Name="button4" DockPanel.Dock="Bottom">Button5</Button>                </ItemsControl>           &nb

          G Offline
          G Offline
          Gideon Engelberth
          wrote on last edited by
          #4

          The buttons are being reordered because they are no longer children of the DockPanel. Instead the ItemsControl is now ordering the buttons. I would suggest using a StackPanel inside of a ScrollViewer and just inserting the new button as the first child.

          <ScrollViewer>
          <StackPanel Name="spButtons">
          <Button Name="button4">Last added, on top</Button>
          <Button Name="button3">Next to last</Button>
          <Button Name="button2">Second</Button>
          <Button Name="button1">First added, on bottom</Button>
          </StackPanel>
          </ScrollViewer>

          Then you can add new buttons on top like this:

          spButtons.Children.Insert(0, buttonToAdd)

          1 Reply Last reply
          0
          Reply
          • Reply as topic
          Log in to reply
          • Oldest to Newest
          • Newest to Oldest
          • Most Votes


          • Login

          • Don't have an account? Register

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • World
          • Users
          • Groups