Skip to content

[Spec] Border #12

Closed
Closed

Description

@jsuarezruiz

Border Options

Views can't easily be given borders without nesting them in frames or implementing custom renderers.

border-options

API

The following properties need to be added on the Border static class:

public static readonly BindableProperty BorderThicknessProperty =
     BindableProperty.Create(propertyName: nameof(BorderThickness),
	     returnType: typeof(Thickness), declaringType: typeof(View));
		
public static readonly BindableProperty BorderColorProperty =
	BindableProperty.Create(propertyName: nameof(BorderColor),
		returnType: typeof(Color), declaringType: typeof(View));

And on IBorder: BorderThickness

Thickness BorderThickness { get; }
Color BorderColor{ get; }

void OnBorderThicknessPropertyChanged(Thickness oldValue, Thickness newValue);
void OnBorderColorPropertyChanged(Color oldValue, Color newValue);

Renderers will frame the given view using the given border properties

The following Views should implement the IBorder interface:

  • Entry
  • Button
  • Frame
  • DatePicker
  • Picker
  • TimePicker

Scenarios

Let's see an example using C #, XAML and CSS.

C# Example

var entry = new Entry();
entry.BorderThickness = new Thickness (2);
entry.BorderColor = Color.Red;

XAML Example

<Entry
     BorderThickness="2"
     BorderColor="Red" />

CSS Example

.entry 
{  
    border-width: 2px;
    border-color: red;
}

Difficulty : Easy

Activity

  1. sacdevops commented on Feb 4, 2021

    @sacdevops

    A compact spelling might be an option for the future after reaching the first milestones. As you know it from HTML / CSS a simplified version for XAML and C#. It could read like this:
    XAML
    <Entry Border="2, red, solid" />

    C#
    var entry = new Entry(); entry.Border = new Border(2, Colors.red, BorderStyle.solid);

    For example, BorderStyle is an option because it is solid by default.

  2. mhrastegari commented on Apr 13, 2021

    @mhrastegari

    Awesome ❤

  3. added this to the 6.0.100-preview.7 milestone on Jul 16, 2021
  4. jsuarezruiz commented on Oct 22, 2021

    @jsuarezruiz
    ContributorAuthor

    Already implemented in Preview 9.

  5. ghost locked as resolved and limited conversation to collaborators on Feb 19, 2022
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

    proposal/opent/enhancement ☀️

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions