2016-05-11 05:53:34 +03:00
|
|
|
|
using System;
|
|
|
|
|
using System.ComponentModel;
|
|
|
|
|
using Bit.App.Controls;
|
|
|
|
|
using Bit.iOS.Controls;
|
|
|
|
|
using UIKit;
|
|
|
|
|
using Xamarin.Forms;
|
|
|
|
|
using Xamarin.Forms.Platform.iOS;
|
|
|
|
|
|
2016-05-12 00:30:09 +03:00
|
|
|
|
[assembly: ExportRenderer(typeof(ExtendedPicker), typeof(ExtendedPickerRenderer))]
|
2016-05-11 05:53:34 +03:00
|
|
|
|
namespace Bit.iOS.Controls
|
|
|
|
|
{
|
|
|
|
|
public class ExtendedPickerRenderer : PickerRenderer
|
|
|
|
|
{
|
|
|
|
|
protected override void OnElementChanged(ElementChangedEventArgs<Picker> e)
|
|
|
|
|
{
|
|
|
|
|
base.OnElementChanged(e);
|
|
|
|
|
|
|
|
|
|
var view = e.NewElement as ExtendedPicker;
|
|
|
|
|
if(view != null)
|
|
|
|
|
{
|
|
|
|
|
SetBorder(view);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
protected override void OnElementPropertyChanged(object sender, PropertyChangedEventArgs e)
|
|
|
|
|
{
|
|
|
|
|
base.OnElementPropertyChanged(sender, e);
|
|
|
|
|
|
|
|
|
|
var view = (ExtendedPicker)Element;
|
|
|
|
|
|
2016-05-12 00:30:09 +03:00
|
|
|
|
if(e.PropertyName == ExtendedPicker.HasBorderProperty.PropertyName)
|
2016-05-11 05:53:34 +03:00
|
|
|
|
{
|
|
|
|
|
SetBorder(view);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2016-05-12 00:30:09 +03:00
|
|
|
|
private void SetBorder(ExtendedPicker view)
|
2016-05-11 05:53:34 +03:00
|
|
|
|
{
|
2016-05-12 00:30:09 +03:00
|
|
|
|
Control.BorderStyle = view.HasBorder ? UITextBorderStyle.RoundedRect : UITextBorderStyle.None;
|
2016-05-11 05:53:34 +03:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|