728x90
728x170
Picker 에서 UnderLine 제거하는 방법입니다.
BorderlessPicker.cs
namespace SuaveControls.MaterialForms
{
public class BorderlessPicker : Picker
{
}
}
BorderlessPickerRenderer.cs – Android
[assembly: ExportRenderer(typeof(BorderlessPicker), typeof(BorderlessPickerRenderer))]
namespace SuaveControls.MaterialForms.Android.Renderers
{
public class BorderlessPickerRenderer : PickerRenderer
{
public static void Init() { }
protected override void OnElementChanged(ElementChangedEventArgs<Picker> e)
{
base.OnElementChanged(e);
if (e.OldElement == null)
{
Control.Background = null;
var layoutParams = new MarginLayoutParams(Control.LayoutParameters);
layoutParams.SetMargins(0, 0, 0, 0);
LayoutParameters = layoutParams;
Control.LayoutParameters = layoutParams;
Control.SetPadding(0, 0, 0, 0);
SetPadding(0, 0, 0, 0);
}
}
}
}
BorderlessPickerRenderer.cs – iOS
[assembly: ExportRenderer(typeof(BorderlessPicker), typeof(BorderlessPickerRenderer))]
namespace SuaveControls.MaterialForms.iOS.Renderers
{
public class BorderlessPickerRenderer : PickerRenderer
{
public static void Init() { }
protected override void OnElementPropertyChanged(object sender, PropertyChangedEventArgs e)
{
base.OnElementPropertyChanged(sender, e);
Control.Layer.BorderWidth = 0;
Control.BorderStyle = UITextBorderStyle.None;
}
}
}
BorderlessPickerRenderer.cs – UWP
[assembly: ExportRenderer(typeof(BorderlessPicker), typeof(BorderlessPickerRenderer))]
namespace SuaveControls.MaterialForms.UWP.Renderers
{
public class BorderlessPickerRenderer : PickerRenderer
{
public static void Init() { }
protected override void OnElementChanged(ElementChangedEventArgs<Picker> e)
{
base.OnElementChanged(e);
if (Control != null)
{
Control.BorderThickness = new Windows.UI.Xaml.Thickness(0);
Control.Margin = new Windows.UI.Xaml.Thickness(0);
Control.Padding = new Windows.UI.Xaml.Thickness(0);
}
}
}
}
728x90
그리드형
'C# > Xamarin Maui' 카테고리의 다른 글
[Xamarin] url image 가 표시 되지 않을 때 (0) | 2019.12.19 |
---|---|
[Xamarin] Xamarin.AndroidX.Migration 설치 명령 (0) | 2019.12.03 |
[Xamarin] 에러 - unable to get provider com.google.android.gms.ads.mobileadsinitprovider: java.lang.illegalstateexception: (0) | 2019.12.03 |
Xamarin.Forms 자습서 (0) | 2019.11.16 |
[Xamarin] 에러 - "APP" can't be transparent nor contain an alpha channel. (0) | 2019.10.28 |