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

61 lines
1.9 KiB
C#
Raw Normal View History

using System;
using Xamarin.Forms;
namespace Bit.App.Controls
{
public class ExtendedTextCell : TextCell
{
2016-06-17 07:01:25 +03:00
public ExtendedTextCell()
{
2017-05-30 21:13:53 +03:00
if(Device.RuntimePlatform == Device.Android)
{
TextColor = Color.Black;
}
2016-06-17 07:01:25 +03:00
DetailColor = Color.FromHex("777777");
}
public static readonly BindableProperty BackgroundColorProperty =
BindableProperty.Create(nameof(BackgroundColor), typeof(Color), typeof(ExtendedTextCell), Color.White);
public static readonly BindableProperty ShowDisclousureProperty =
2016-07-01 07:03:54 +03:00
BindableProperty.Create(nameof(ShowDisclousure), typeof(bool), typeof(ExtendedTextCell), false);
public static readonly BindableProperty DisclousureImageProperty =
BindableProperty.Create(nameof(DisclousureImage), typeof(string), typeof(ExtendedTextCell), string.Empty);
public Color BackgroundColor
{
get { return (Color)GetValue(BackgroundColorProperty); }
set { SetValue(BackgroundColorProperty, value); }
}
public bool ShowDisclousure
{
get { return (bool)GetValue(ShowDisclousureProperty); }
set { SetValue(ShowDisclousureProperty, value); }
}
public string DisclousureImage
{
get { return (string)GetValue(DisclousureImageProperty); }
set { SetValue(DisclousureImageProperty, value); }
}
2016-08-23 05:59:42 +03:00
public LineBreakMode DetailLineBreakMode { get; set; } = LineBreakMode.TailTruncation;
public event EventHandler DisclousureTapped;
public void OnDisclousureTapped()
{
if(DisclousureTapped == null)
{
OnTapped();
return;
}
DisclousureTapped.Invoke(this, EventArgs.Empty);
}
}
}