Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to Make Top (or Bottom) Rounded Rectangle Corners in Silverlight?

So the Rectangle control has RadiusX and RadiusY property for making rounded corners. However, this affects ALL corners but I'd like to know if there's a way to just affect the top corners, or the bottom corners, etc. Is there a way?

like image 488
Shai UI Avatar asked Apr 20 '10 02:04

Shai UI


2 Answers

Take a look at the Border control CornerRadius property:

  <Grid Width="100" Height="100">  
  <Border 
  BorderBrush="SlateBlue" 
  BorderThickness="5,10,15,20" 
  Background="Tomato" Padding="5"
  CornerRadius="5,10,15,20">
    <Rectangle Fill="Yellow" />
  </Border>
  </Grid>
like image 54
Metro Smurf Avatar answered Nov 17 '22 19:11

Metro Smurf


You can overlay two rectangle, one on top of the other. On the bottom rectangle, set the RadiusX and RadiusY properties, on the top rectangle keep them unset and then move it over the rounded top or bottom.

Make them the same color and it will look like a single rectangle with only the top or bottom rounded.

like image 1
Jim Wallace Avatar answered Nov 17 '22 18:11

Jim Wallace