[Proposal] RemoveBorderEffect
See original GitHub issueRemoveBorderEffect
- Proposed
- Prototype: Not Started
- Implementation: Not Started
- iOS Support
- Android Support
- macOS Support
- Windows Support
- Unit Tests: Not Started
- Sample: Not Started
- Documentation: Not Started
Summary
Removes a border from a VisualElement
Detailed Design
RemoveBorderEffect.shared.cs
public class RemoveBorderEffect : RoutingEffect
{
}
RemoveBorderEffect.Android.cs
public class RemoveBorderEffect : PlatformEffect
{
Drawable? originalBackground;
protected override void OnAttached()
{
originalBackground = Control.Background;
var shape = new ShapeDrawable(new RectShape());
if (shape.Paint != null)
{
shape.Paint.Color = global::Android.Graphics.Color.Transparent;
shape.Paint.StrokeWidth = 0;
shape.Paint.SetStyle(Paint.Style.Stroke);
}
Control.Background = shape;
}
protected override void OnDetached() => Control.Background = originalBackground;
}
RemoveBorderEffect.iOS.cs
public class RemoveBorderEffect : PlatformEffect
{
UITextBorderStyle? oldBorderStyle;
UITextField? TextField => Control as UITextField;
protected override void OnAttached()
{
oldBorderStyle = TextField?.BorderStyle;
SetBorderStyle(UITextBorderStyle.None);
}
protected override void OnDetached() => SetBorderStyle(oldBorderStyle);
void SetBorderStyle(UITextBorderStyle? borderStyle)
{
if (TextField != null && borderStyle.HasValue)
TextField.BorderStyle = borderStyle.Value;
}
}
RemoveBorderEffect.uwp.cs
public class RemoveBorderEffect : PlatformEffect
{
Thickness oldBorderThickness;
protected override void OnAttached()
{
if (Control is Control uwpControl)
{
oldBorderThickness = uwpControl.BorderThickness;
uwpControl.BorderThickness = new Thickness(0.0);
}
}
protected override void OnDetached()
{
if (Control is Control uwpControl)
{
uwpControl.BorderThickness = oldBorderThickness;
}
}
}
Usage Syntax
XAML Usage
<Label
<Label.Effects>
<local: RemoveBorderEffect/>
</Label.Effects>
</Label>
C# Usage
var label = new Label();
label.Effects.Add(new RemoveBorderEffect());
Issue Analytics
- State:
- Created 2 years ago
- Comments:10 (9 by maintainers)
Top Results From Across the Web
New Feature Proposals
NET MAUI developer easier - New Feature Proposals · CommunityToolkit/Maui. ... [Proposal] `ValueTask Async Command ... [Proposal] RemoveBorderEffect.
Read more >RemoveBorderEffect Class (Xamarin.CommunityToolkit. ...
RemoveBorderEffect Class · In this article · Definition · Constructors · Applies to · Additional resources.
Read more >Features List · xamarin/XamarinCommunityToolkit Wiki
RemoveBorderEffect, Removes a border from a VisualElement, TBD. SafeAreaEffect, Indicates whether or not that element should take current ...
Read more >Multistrategy Self-Organizing Map Learning for ...
The proposed method was used to remove border effect in SOM, but the limitation was slower in computation times. Furthermore, Kihato et al....
Read more >Deinterlacing, Scaling, Processing: Special OSSC Review ...
All of these offer fantastic results, but all of them are very ... optimized output timings (to remove border effect on certain TVs)...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
In order to remove the Entry border you can do the following for android and ios:
For windows just add these resources on your
Platform/Windows/App.xaml
With that I still believe it’s a very simple code to keep here.
@KSemenenko you can open an issue on Maui repo itself, since it’s related to a control… Maybe it’s something that you can solve already using an style.