Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support rounded corners on Border #83

Closed
abrull opened this issue Dec 28, 2021 · 4 comments
Closed

Support rounded corners on Border #83

abrull opened this issue Dec 28, 2021 · 4 comments

Comments

@abrull
Copy link

abrull commented Dec 28, 2021

Is your feature request related to a problem? Please describe.
I'd like to make a border around an element similar to css border-radius

@MarcinZiabek
Copy link
Member

Hello 😀

The border-radius functionality is not currently supported out-of-the-box. If more people request this functionality, I can analyse adding it to the library.

However, you can easily achieve the effect by using the Canvas element, like so:

.Box()
.Layers(layers =>
{
    layers.PrimaryLayer().Padding(10).Text("Sample text");
    
    layers.Layer().Canvas((canvas, size) =>
    {
        using var paint = new SKPaint
        {
            Color = SKColor.Parse(Colors.Black),
            IsStroke = true,
            StrokeWidth = 1,
            IsAntialias = true
        };
        
        canvas.DrawRoundRect(0, 0, size.Width, size.Height, 20, 20, paint);
    });
});

Effect:
image

@abrull
Copy link
Author

abrull commented Dec 31, 2021

Hey! Thanks so much for the tip. I was able to implement our design perfectly. I'm closing the issue

@abrull abrull closed this as completed Dec 31, 2021
@lpunderscore
Copy link

I know this is closed, but this saved me.

1 upvote for out-of-the-box support for radius specification (fill and stroke) / backgound etc..

@Ruitjes
Copy link

Ruitjes commented Sep 16, 2023

If out-of-the-box support could be added that would be amazing!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants