Traitée Round only 2 edges of border

  • mercredi 30 août 2006 14:54
     
     
    Hi!
    Is there any way to round only 2 of 4 edges of border?

Toutes les réponses

  • mercredi 30 août 2006 15:00
     
     

    I can only think of one way, and it seems like a lot of work.  Let's say you want the rounded edges to be on the top, with a black border color.  You could put two Borders in a grid cell, so that they are on top of each other in the z-order.  Set the BorderBrush of one Border to a LinearGradientBrush which draws from Black to Transparent, going from top to bottom.  The other Border's BorderBrush goes from Black to Transparent, but the gradient goes from bottom to top.  Set the first Border's CornerRadius to some non-zero value.  If you get it just right, it should look like one border because the two gradients would blend together at the just right place.

    That might work...

  • mercredi 30 août 2006 16:05
     
     
    Thanx Josh!

    I've stopped on the half-way of proposed solution
    Because the result appeared even more satisfactory than desired.
    I used only one border with gradient background and gradient brush as you said

  • mercredi 30 août 2006 16:07
     
     
    I'm glad that worked out for you, Andrew. :)
  • mercredi 30 août 2006 22:01
     
     Traitée

    You can set CornerRadius directly: "TopLeft, TopRight, BottomRight, BottomLeft"

    <Border CornerRadius="50,50,0,0" BorderThickness="10" BorderBrush="cyan"/>