Rounded corners on a StackPanel?

Greetings,

How would I achieve the effect of rounded corners on the background of a StackPanel The Ellipse class has RadiusX and RadiusY properties which are simple enough, but the StackPanel doesn't seem to have anything like this.

Thanks,
Billy



Answer this question

Rounded corners on a StackPanel?

  • Bruce VB

    Its cornerRadius on the Border :)
  • Surya Suluh

    lester - MSFT wrote:
    Its cornerRadius on the Border :)

    Good catch: I was writing too speed :)



  • Embedded Developer

    Create a Template for your StackPanel and use a Border in this Template.

    Border has a CornerRadius which you will need to use to have rounded corners.

     

    HTH

     

    Bye



  • Mike Prilliman

    Drew Marsh wrote:

    You don't need to edit the template. Simply put the StackPanel inside of a Border and you're done. Like so:

    <Border BorderBrush="Red" CornerRadius="2,2,2,2" BorderThickness="2,2,2,2">
    <StackPanel Background="Gray" >
    <!-- your elements here -->
    </StackPanel>
    </Border>

    HTH,
    Drew

    Of course! Thank you!


  • SuebsakulP

    Thanks for your answer.

    I'm really too new to XAML to be able to pull of this template... Could anyone please show me how such a template would be constructed (and used from a StackPanel) It would be much appreciated.

    Thanks a lot!

    /Billy


  • Richard Arthur

    You don't need to edit the template. Simply put the StackPanel inside of a Border and you're done. Like so:

    <Border BorderBrush="Red" CornerRadius="2,2,2,2" BorderThickness="2,2,2,2">
    <StackPanel Background="Gray" >
    <!-- your elements here -->
    </StackPanel>
    </Border>

    HTH,
    Drew


  • Rounded corners on a StackPanel?