Shai UI
Shai UI

Reputation: 51958

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?

Upvotes: 6

Views: 7016

Answers (2)

Metro Smurf
Metro Smurf

Reputation: 38385

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>

Upvotes: 12

Jim Wallace
Jim Wallace

Reputation: 1056

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.

Upvotes: 1

Related Questions