mirror of
https://github.com/bitwarden/android.git
synced 2026-05-08 04:16:40 -05:00
44 lines
1.5 KiB
C#
44 lines
1.5 KiB
C#
using Xamarin.Forms;
|
|
|
|
namespace Bit.App.Controls
|
|
{
|
|
public class SectionHeaderViewCell : ExtendedViewCell
|
|
{
|
|
public SectionHeaderViewCell(string bindingName, string countBindingName = null, Thickness? padding = null)
|
|
{
|
|
var label = new Label
|
|
{
|
|
FontSize = Device.GetNamedSize(NamedSize.Small, typeof(Label)),
|
|
Style = (Style)Application.Current.Resources["text-muted"],
|
|
VerticalTextAlignment = TextAlignment.Center,
|
|
HorizontalOptions = LayoutOptions.StartAndExpand
|
|
};
|
|
|
|
label.SetBinding(Label.TextProperty, bindingName);
|
|
|
|
var stackLayout = new StackLayout
|
|
{
|
|
Padding = padding ?? new Thickness(16, 8, 0, 8),
|
|
Children = { label },
|
|
Orientation = StackOrientation.Horizontal
|
|
};
|
|
|
|
if(!string.IsNullOrWhiteSpace(countBindingName))
|
|
{
|
|
var countLabel = new Label
|
|
{
|
|
LineBreakMode = LineBreakMode.NoWrap,
|
|
FontSize = Device.GetNamedSize(NamedSize.Small, typeof(Label)),
|
|
Style = (Style)Application.Current.Resources["text-muted"],
|
|
HorizontalOptions = LayoutOptions.End
|
|
};
|
|
countLabel.SetBinding(Label.TextProperty, countBindingName);
|
|
stackLayout.Children.Add(countLabel);
|
|
}
|
|
|
|
View = stackLayout;
|
|
BackgroundColor = Color.FromHex("efeff4");
|
|
}
|
|
}
|
|
}
|