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. how do I get a rectangle with rounded edges to contain a textbox and a button ?

how do I get a rectangle with rounded edges to contain a textbox and a button ?

Scheduled Pinned Locked Moved WCF and WF
questionwpftutorial
3 Posts 2 Posters 0 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.
  • A Offline
    A Offline
    abiemann
    wrote on last edited by
    #1

    So, how do I get a rectangle with rounded edges to contain a textbox and a button ? additionally, the rectangle should stretch automatically as the form is resized by the user. this is the XAML so far: <ScrollViewer Margin="0,23" Name="ScrollViewer1" HorizontalScrollBarVisibility="Auto"> <StackPanel Name="StackPanel1"> <DockPanel Height="100" Width="Auto" Name="DockPanel1" LastChildFill="True"> <TextBox Height="23" DockPanel.Dock="Top" /> <Button Height="23" Name="Button4" Width="75" DockPanel.Dock="Bottom" HorizontalAlignment="Right">Button</Button> <TextBox DockPanel.Dock="Left" /> </DockPanel> <DockPanel Height="100" Width="Auto" Name="DockPanel2" LastChildFill="True"> <TextBox Height="23" DockPanel.Dock="Top" /> <Button Height="23" Name="Button5" Width="75" DockPanel.Dock="Bottom" HorizontalAlignment="Right">Button</Button> <TextBox DockPanel.Dock="Left" /> </DockPanel> </StackPanel> </ScrollViewer> The scrollviewer fills the window and I'm going to fill it with a load of DockPanel's that contain bits of info and a button. It's resizing great when the user changes the window size, but the DockPanel's should have rounded edges... which I can't work out how to do.

    M 1 Reply Last reply
    0
    • A abiemann

      So, how do I get a rectangle with rounded edges to contain a textbox and a button ? additionally, the rectangle should stretch automatically as the form is resized by the user. this is the XAML so far: <ScrollViewer Margin="0,23" Name="ScrollViewer1" HorizontalScrollBarVisibility="Auto"> <StackPanel Name="StackPanel1"> <DockPanel Height="100" Width="Auto" Name="DockPanel1" LastChildFill="True"> <TextBox Height="23" DockPanel.Dock="Top" /> <Button Height="23" Name="Button4" Width="75" DockPanel.Dock="Bottom" HorizontalAlignment="Right">Button</Button> <TextBox DockPanel.Dock="Left" /> </DockPanel> <DockPanel Height="100" Width="Auto" Name="DockPanel2" LastChildFill="True"> <TextBox Height="23" DockPanel.Dock="Top" /> <Button Height="23" Name="Button5" Width="75" DockPanel.Dock="Bottom" HorizontalAlignment="Right">Button</Button> <TextBox DockPanel.Dock="Left" /> </DockPanel> </StackPanel> </ScrollViewer> The scrollviewer fills the window and I'm going to fill it with a load of DockPanel's that contain bits of info and a button. It's resizing great when the user changes the window size, but the DockPanel's should have rounded edges... which I can't work out how to do.

      M Offline
      M Offline
      michmela44
      wrote on last edited by
      #2

      Not completely sure if it is what you are looking for, but you can try this...

      <ScrollViewer Margin="0,23" Name="ScrollViewer1" HorizontalScrollBarVisibility="Auto">
      <StackPanel Name="StackPanel1">

      <Border CornerRadius="10" Background="#444444">
      <DockPanel Height="100" Width="Auto" Name="DockPanel1" LastChildFill="True">
      <TextBox Height="23" DockPanel.Dock="Top" Margin="15,15,15,0"/>
      <Button Height="23" Name="Button4" Width="75" DockPanel.Dock="Bottom" HorizontalAlignment="Right" Margin="0,0,15,0">Button</Button>
      </DockPanel>
      </Border>
      <Border CornerRadius="10" Background="#444444" Margin="0,10,0,0">
      <DockPanel Height="100" Width="Auto" Name="DockPanel2" LastChildFill="True">
      <TextBox Height="23" DockPanel.Dock="Top" Margin="15,15,15,0" />
      <Button Height="23" Name="Button5" Width="75" DockPanel.Dock="Bottom" HorizontalAlignment="Right" Margin="0,0,15,0">Button</Button>
      </DockPanel>
      </Border>
      </StackPanel>
      </ScrollViewer>

      A 1 Reply Last reply
      0
      • M michmela44

        Not completely sure if it is what you are looking for, but you can try this...

        <ScrollViewer Margin="0,23" Name="ScrollViewer1" HorizontalScrollBarVisibility="Auto">
        <StackPanel Name="StackPanel1">

        <Border CornerRadius="10" Background="#444444">
        <DockPanel Height="100" Width="Auto" Name="DockPanel1" LastChildFill="True">
        <TextBox Height="23" DockPanel.Dock="Top" Margin="15,15,15,0"/>
        <Button Height="23" Name="Button4" Width="75" DockPanel.Dock="Bottom" HorizontalAlignment="Right" Margin="0,0,15,0">Button</Button>
        </DockPanel>
        </Border>
        <Border CornerRadius="10" Background="#444444" Margin="0,10,0,0">
        <DockPanel Height="100" Width="Auto" Name="DockPanel2" LastChildFill="True">
        <TextBox Height="23" DockPanel.Dock="Top" Margin="15,15,15,0" />
        <Button Height="23" Name="Button5" Width="75" DockPanel.Dock="Bottom" HorizontalAlignment="Right" Margin="0,0,15,0">Button</Button>
        </DockPanel>
        </Border>
        </StackPanel>
        </ScrollViewer>

        A Offline
        A Offline
        abiemann
        wrote on last edited by
        #3

        that is very nice! My brain got stuck on using a canvas and a rectangle. thanks for the help !

        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