views:

448

answers:

2

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?

+1  A: 

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.

Jim Wallace
Unless there's some underlying reason why you'd have to use a rectangle overlaying another rectangle, the Border control is suited for controlling each corner's radius via the CornerRadius property.
Metro Smurf
+3  A: 

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>
Metro Smurf