C#/Xamarin Maui
[.NET MAUI] Entry, Picker 에서 line 제거 하기
kjun.kr
2023. 7. 2. 22:32
728x90
아래 그림처럼 Entry 와 Picker 에서는 아래 처럼 under line 이나 box가 나타납니다.


언더라인과 박스를 제거하는 방법입니다.
MauiProgram.cs 에 아래 코드를 추가합니다.
#if DEBUG
builder.Logging.AddDebug();
#endif
Microsoft.Maui.Handlers.EntryHandler.Mapper.AppendToMapping("Borderless", (handler, view) =>
{
#if ANDROID
handler.PlatformView.Background = null;
handler.PlatformView.SetBackgroundColor(Android.Graphics.Color.Transparent);
#elif IOS
handler.PlatformView.BackgroundColor = UIKit.UIColor.Clear;
handler.PlatformView.Layer.BorderWidth = 0;
handler.PlatformView.BorderStyle = UIKit.UITextBorderStyle.None;
#endif
});
Microsoft.Maui.Handlers.PickerHandler.Mapper.AppendToMapping("Borderless", (handler, view) =>
{
#if ANDROID
handler.PlatformView.Background = null;
handler.PlatformView.SetBackgroundColor(Android.Graphics.Color.Transparent);
#elif IOS
handler.PlatformView.BackgroundColor = UIKit.UIColor.Clear;
handler.PlatformView.Layer.BorderWidth = 0;
handler.PlatformView.BorderStyle = UIKit.UITextBorderStyle.None;
#endif
});
결과


728x90