Repository navigation
Closed
Labels
area-drawingShapes, Borders, Shadows, Graphics, BoxView, custom drawingproposal/opent/enhancement ☀️New feature or request
Milestone
Description
Rounded Corners
Rounded Corners are a common visual requirement.
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.
Reacted by informata, sagar_panwala22, MBuelowius, Clifford Agius, Giampaolo Gabba, Mohammad Hossein Rastegarinia, Poopooracoocoo, saint4eva, Softtinn, Emil Alipiev and 13 more
Reacted by Felipe Baltazar, Erlend Angelsen, Skye Hoefling, Marcus Orciuch, Ryouko Konpaku, Chris Howarth, Samir GC, Sérgio Damasceno, Mohammad Hossein Rastegarinia, saint4eva and 7 more
Reacted by Sergio Joel Ferreras Batista, Dan Kyungu, Mohammad Hossein Rastegarinia, saint4eva, Labros Papadopoulos, LIT, Mario Gabriell Karaziaki and Seyyid Ahmed Ciftci
Metadata
Metadata
Assignees
Labels
area-drawingShapes, Borders, Shadows, Graphics, BoxView, custom drawingproposal/opent/enhancement ☀️New feature or request

Activity
aguywithcode commentedon May 20, 2020
Looks like Button has a CornerRadiusProperty already. Perhaps it should be extracted to a higher class in the tree perhaps View or VisualElement?
ederbond commentedon Jun 26, 2020
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
MitchBomcanhao commentedon Jun 30, 2020
Would the rounded corners clip the content of the control?
themronion commentedon Mar 1, 2021
What about single rounded corners on frame - like PancakeView? I think this is more desirable and wanted by xamarin devs. Thumbs up who agrees!
Address code review: security hardening and cleanup