public abstract class CellRenderer : IRegisterable
{
const string _heightProperty = "Height";
- protected static readonly EColor s_defaultTextColor = EColor.Black;
- protected static readonly EColor s_defaultBackgroundColor = EColor.White;
readonly Dictionary<Cell, Dictionary<string, EvasObject>> _realizedNativeViews = new Dictionary<Cell, Dictionary<string, EvasObject>>();
protected CellRenderer(string style)
{
var nativeSpan = new Native.Span();
nativeSpan.Text = span.Text;
- nativeSpan.ForegroundColor = span.ForegroundColor.IsDefault ? s_defaultTextColor : span.ForegroundColor.ToNative();
+ nativeSpan.ForegroundColor = span.ForegroundColor.ToNative();
nativeSpan.FontAttributes = span.FontAttributes;
- nativeSpan.BackgroundColor = span.BackgroundColor.IsDefault ? s_defaultBackgroundColor : span.BackgroundColor.ToNative();
+ nativeSpan.BackgroundColor = span.BackgroundColor.ToNative();
nativeSpan.FontSize = span.FontSize;
nativeSpan.FontFamily = span.FontFamily;
return nativeSpan;
string GetText(object data, string part)
{
var span = OnGetText((data as Native.ListView.ItemContext).Cell, part);
- return span != null ? ToNative(span).GetDecoratedText() : null;
+ return span != null ? ToNative(span).GetMarkupText() : null;
}
EvasObject GetContent(object data, string part)
public class EntryCellRenderer : ViewCellRenderer
{
const int _defaultHeight = 120;
+ static readonly EColor s_defaultLabelColor = EColor.Black;
readonly Dictionary<EvasObject, NativeEntryComponent> _realizedComponent = new Dictionary<EvasObject, NativeEntryComponent>();
public EntryCellRenderer()
{
IsSingleLine = true,
Text = entryCell.Text,
- TextColor = s_defaultTextColor,
Placeholder = entryCell.Placeholder,
- PlaceholderColor = s_defaultTextColor,
Keyboard = entryCell.Keyboard.ToNative(),
HorizontalTextAlignment = entryCell.HorizontalTextAlignment.ToNative(),
};
EColor GetLabelColor(EntryCell cell)
{
- return cell.LabelColor.IsDefault ? s_defaultTextColor : cell.LabelColor.ToNative();
+ return cell.LabelColor.IsDefault ? s_defaultLabelColor : cell.LabelColor.ToNative();
}
class NativeEntryComponent
return new Span()
{
Text = cell.Text,
- ForegroundColor = cell.TextColor
+ ForegroundColor = cell.TextColor,
+ FontSize = -1
};
}
return new Span()
{
Text = cell.Detail,
- ForegroundColor = cell.DetailColor
+ ForegroundColor = cell.DetailColor,
+ FontSize = -1
};
}
/// </summary>
public class Span
{
+ static EColor s_defaultLineColor = EColor.Black;
string _text;
/// <summary>
FontFamily = "";
FontSize = -1;
FontAttributes = FontAttributes.None;
- ForegroundColor = EColor.White;
- BackgroundColor = EColor.Transparent;
+ ForegroundColor = EColor.Default;
+ BackgroundColor = EColor.Default;
HorizontalTextAlignment = TextAlignment.Auto;
VerticalTextAlignment = TextAlignment.Auto;
LineBreakMode = LineBreakMode.MixedWrap;
StringBuilder PrepareFormattingString(StringBuilder _formattingString)
{
- var foregroundColor = ForegroundColor.ToHex();
-
- _formattingString.AppendFormat("color={0} ", foregroundColor);
+ if (!ForegroundColor.IsDefault)
+ {
+ _formattingString.AppendFormat("color={0} ", ForegroundColor.ToHex());
+ }
- _formattingString.AppendFormat("backing_color={0} ", BackgroundColor.ToHex());
- _formattingString.Append("backing=on ");
+ if (!BackgroundColor.IsDefault)
+ {
+ _formattingString.AppendFormat("backing_color={0} backing=on ", BackgroundColor.ToHex());
+ }
if (!string.IsNullOrEmpty(FontFamily))
{
if (Underline)
{
- _formattingString.AppendFormat("underline=on underline_color={0} ", foregroundColor);
+ _formattingString.AppendFormat("underline=on underline_color={0} ",
+ ForegroundColor.IsDefault ? s_defaultLineColor.ToHex() : ForegroundColor.ToHex());
}
if (Strikethrough)
{
- _formattingString.AppendFormat("strikethrough=on strikethrough_color={0} ", foregroundColor);
+ _formattingString.AppendFormat("strikethrough=on strikethrough_color={0} ",
+ ForegroundColor.IsDefault ? s_defaultLineColor.ToHex() : ForegroundColor.ToHex());
}
switch (HorizontalTextAlignment)