3

I can create a Border element and only make the top corners rounded or I can create a Rectangle element (acting as a border) with a dashed stroke.

Now how do I create a border that actually can do BOTH these things?

(I do not want rounded bottom corners!)

1 Answer 1

2

I created a UserControl which contains a Border whose Background is a VisualBrush made up of four Rectangles, each occupying the same space but has the Clip property set to one of the four corners. Combining these Rectangles and you get a pretty similar effect to what you're after. It also has the relevant Dependency Properties from Border and Rectangle combined

Use it like this

<Controls:RectangleBorder Stroke="Red"
                          StrokeThickess="6"
                          StrokeDashArray="1.0 1.0"
                          CornerRadius="20,20,0,0">
    <Button Content="Test" Margin="5"/>
</Controls:RectangleBorder>

And the result looks like this

enter image description here

Uploaded the RoundedRectangleLibrary here if you want to try it out
http://www.mediafire.com/?44300c4xmy3d1m6

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.