Skip to content

[Spec] Rounded Corners #10

Closed
Closed

Description

@jsuarezruiz

Rounded Corners

Rounded Corners are a common visual requirement.

corners

API

We need to add an interface for defining what's required for a View to implement corner rounding (and provide CSS support):

interface IRoundedCorner
{
	CornerRadius CornerRadius { get; }
	void CornerRadiusChanged(CornerRadius oldValue, CornerRadius newValue);
}

The CornerRadius BindableProperty can be implemented in one place:

static class RoundedCorner
{
	public static readonly BindableProperty CornerRadiusProperty = 
	     BindableProperty.Create(nameof(CornerRadius), typeof(CornerRadius), typeof(IRoundedCorners));
}

The following Views are candidates for rounded corners:

  • BoxView
  • Button
  • Image
  • ImageButton
  • Layouts
  • ScrollView

Scenarios

C# Example

var grid = new Grid();
grid.CornerRadius = new CornerRadius(12, 0, 12, 6);

XAML Example

<Grid
     CornerRadius="12, 0, 12, 6">
</Grid>

Difficulty: Medium

Providing the interface is simple; individual implementations may vary in difficulty.

Activity

  1. aguywithcode commented on May 20, 2020

    @aguywithcode

    Looks like Button has a CornerRadiusProperty already. Perhaps it should be extracted to a higher class in the tree perhaps View or VisualElement?

  2. ederbond commented on Jun 26, 2020

    @ederbond
    Contributor

    Also make sure that if the element is set to have shadow, the shadow should be rounded too.
    I've opened some issues for this in the past too. xamarin/Xamarin.Forms#3867
    and here xamarin/Xamarin.Forms#3871

  3. MitchBomcanhao commented on Jun 30, 2020

    @MitchBomcanhao

    Would the rounded corners clip the content of the control?

  4. themronion commented on Mar 1, 2021

    @themronion

    What about single rounded corners on frame - like PancakeView? I think this is more desirable and wanted by xamarin devs. Thumbs up who agrees!

  5. added this to the 6.0.100-preview.7 milestone on Jul 16, 2021
  6. added
    area-drawing
    on Sep 27, 2021
  7. ghost locked as resolved and limited conversation to collaborators on Feb 19, 2022
  8. added a commit that references this issue on Apr 15, 2026
    48feb96
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    area-drawingproposal/opent/enhancement ☀️

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions