Skip to content
This repository was archived by the owner on May 1, 2024. It is now read-only.

Add remove border effect implementation for uwp #1048

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@ public RemoveBorderEffect()
#elif __ANDROID__
if (DateTime.Now.Ticks < 0)
_ = new Xamarin.CommunityToolkit.Android.Effects.RemoveBorderEffect();
#elif UWP
if (System.DateTime.Now.Ticks < 0)
_ = new Xamarin.CommunityToolkit.UWP.Effects.RemoveBorderEffect();
#endif
#endregion
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
using Windows.UI.Xaml;
using Windows.UI.Xaml.Controls;
using Xamarin.CommunityToolkit.Effects;
using Xamarin.Forms.Platform.UWP;
using Effects = Xamarin.CommunityToolkit.UWP.Effects;

[assembly: Xamarin.Forms.ExportEffect(typeof(Effects.RemoveBorderEffect), nameof(RemoveBorderEffect))]

namespace Xamarin.CommunityToolkit.UWP.Effects
{
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;
}
}
}
}