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

48 lines
1.2 KiB
C#
Raw Normal View History

using System;
using Bit.App.Resources;
using Xamarin.Forms;
namespace Bit.App.Controls
{
public class FormPickerCell : ViewCell
{
public FormPickerCell(string labelText, string[] pickerItems)
{
Label = new Label
{
Text = labelText,
FontSize = 14,
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,
VerticalOptions = LayoutOptions.CenterAndExpand,
Margin = new Thickness(0, 5, 0, 0)
};
foreach(var item in pickerItems)
{
Picker.Items.Add(item);
}
Picker.SelectedIndex = 0;
var stackLayout = new StackLayout
{
2016-05-17 06:54:24 +03:00
Padding = new Thickness(15),
BackgroundColor = Color.White
};
stackLayout.Children.Add(Label);
stackLayout.Children.Add(Picker);
View = stackLayout;
}
public Label Label { get; private set; }
public ExtendedPicker Picker { get; private set; }
}
}