bitwarden-android/src/App/Controls/FormPickerCell.cs

53 lines
1.3 KiB
C#
Raw Normal View History

using System;
using Bit.App.Resources;
using Xamarin.Forms;
namespace Bit.App.Controls
{
public class FormPickerCell : ExtendedViewCell
{
public FormPickerCell(string labelText, string[] pickerItems)
{
Label = new Label
{
Text = labelText,
2016-06-28 03:56:59 +03:00
FontSize = Device.GetNamedSize(NamedSize.Small, typeof(Label)),
2016-05-17 06:54:24 +03:00
TextColor = Color.FromHex("777777"),
VerticalOptions = LayoutOptions.Start
};
Picker = new ExtendedPicker
{
2016-05-17 06:54:24 +03:00
HasBorder = false,
2016-05-19 06:55:30 +03:00
VerticalOptions = LayoutOptions.CenterAndExpand
};
foreach(var item in pickerItems)
{
Picker.Items.Add(item);
}
Picker.SelectedIndex = 0;
var stackLayout = new StackLayout
{
Padding = new Thickness(15, 10)
};
stackLayout.Children.Add(Label);
stackLayout.Children.Add(Picker);
2016-07-05 05:35:49 +03:00
Tapped += FormPickerCell_Tapped;
View = stackLayout;
}
public Label Label { get; private set; }
public ExtendedPicker Picker { get; private set; }
2016-07-05 05:35:49 +03:00
private void FormPickerCell_Tapped(object sender, EventArgs e)
{
Picker.Focus();
}
}
}