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

Commit e49c82a

Browse files
Alex-WitkowskiAlexander Witkowski
andauthored
Add remove border effect implementation for uwp (#1048)
Co-authored-by: Alexander Witkowski <[email protected]>
1 parent 6630a8f commit e49c82a

File tree

2 files changed

+35
-0
lines changed

2 files changed

+35
-0
lines changed

src/CommunityToolkit/Xamarin.CommunityToolkit/Effects/RemoveBorder/RemoveBorderEffect.shared.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,9 @@ public RemoveBorderEffect()
1616
#elif __ANDROID__
1717
if (DateTime.Now.Ticks < 0)
1818
_ = new Xamarin.CommunityToolkit.Android.Effects.RemoveBorderEffect();
19+
#elif UWP
20+
if (System.DateTime.Now.Ticks < 0)
21+
_ = new Xamarin.CommunityToolkit.UWP.Effects.RemoveBorderEffect();
1922
#endif
2023
#endregion
2124
}
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
using Windows.UI.Xaml;
2+
using Windows.UI.Xaml.Controls;
3+
using Xamarin.CommunityToolkit.Effects;
4+
using Xamarin.Forms.Platform.UWP;
5+
using Effects = Xamarin.CommunityToolkit.UWP.Effects;
6+
7+
[assembly: Xamarin.Forms.ExportEffect(typeof(Effects.RemoveBorderEffect), nameof(RemoveBorderEffect))]
8+
9+
namespace Xamarin.CommunityToolkit.UWP.Effects
10+
{
11+
public class RemoveBorderEffect : PlatformEffect
12+
{
13+
Thickness oldBorderThickness;
14+
15+
protected override void OnAttached()
16+
{
17+
if (Control is Control uwpControl)
18+
{
19+
oldBorderThickness = uwpControl.BorderThickness;
20+
uwpControl.BorderThickness = new Thickness(0.0);
21+
}
22+
}
23+
24+
protected override void OnDetached()
25+
{
26+
if (Control is Control uwpControl)
27+
{
28+
uwpControl.BorderThickness = oldBorderThickness;
29+
}
30+
}
31+
}
32+
}

0 commit comments

Comments
 (0)