summaryrefslogtreecommitdiff
path: root/Xamarin.Forms.Platform.Tizen/Cells/TextCellRenderer.cs
diff options
context:
space:
mode:
authorKangho Hur <kangho.hur@samsung.com>2016-12-16 11:00:07 +0900
committerKangho Hur <kangho.hur@samsung.com>2017-04-24 13:36:43 +0900
commit18ad8a74707a1b36581f7123be74d2b34510e016 (patch)
tree92eeac43c2cd01690a321a80e123e957053c4d7d /Xamarin.Forms.Platform.Tizen/Cells/TextCellRenderer.cs
parent80e5482487f8a37d89b620f54f4ff3c12bcc5b83 (diff)
downloadxamarin-forms-18ad8a74707a1b36581f7123be74d2b34510e016.tar.gz
xamarin-forms-18ad8a74707a1b36581f7123be74d2b34510e016.tar.bz2
xamarin-forms-18ad8a74707a1b36581f7123be74d2b34510e016.zip
Add Tizen backend renderer
- Xamarin.Forms.Platform.Tizen has been added - Xamarin.Forms.Maps.Tizen has been added - RPM build spec has been added Change-Id: I0021e0f040d97345affc87512ee0f6ce437f4e6d
Diffstat (limited to 'Xamarin.Forms.Platform.Tizen/Cells/TextCellRenderer.cs')
-rw-r--r--Xamarin.Forms.Platform.Tizen/Cells/TextCellRenderer.cs72
1 files changed, 72 insertions, 0 deletions
diff --git a/Xamarin.Forms.Platform.Tizen/Cells/TextCellRenderer.cs b/Xamarin.Forms.Platform.Tizen/Cells/TextCellRenderer.cs
new file mode 100644
index 00000000..2bea3848
--- /dev/null
+++ b/Xamarin.Forms.Platform.Tizen/Cells/TextCellRenderer.cs
@@ -0,0 +1,72 @@
+using ElmSharp;
+using System.Collections.Generic;
+
+namespace Xamarin.Forms.Platform.Tizen
+{
+ public class TextCellRenderer : CellRenderer
+ {
+ public TextCellRenderer() : this("double_label") { }
+ protected TextCellRenderer(string style) : base(style)
+ {
+ MainPart = "elm.text";
+ DetailPart = "elm.text.sub";
+ }
+
+ protected string MainPart { get; set; }
+ protected string DetailPart { get; set; }
+
+ protected override Span OnGetText(Cell cell, string part)
+ {
+ var textCell = (TextCell)cell;
+ if (part == MainPart)
+ {
+ return OnMainText(textCell);
+ }
+ if (part == DetailPart)
+ {
+ return OnDetailText(textCell);
+ }
+ return null;
+ }
+
+ protected virtual Span OnMainText(TextCell cell)
+ {
+ return new Span()
+ {
+ Text = cell.Text,
+ ForegroundColor = cell.TextColor
+ };
+ }
+
+ protected virtual Span OnDetailText(TextCell cell)
+ {
+ return new Span()
+ {
+ Text = cell.Detail,
+ ForegroundColor = cell.DetailColor
+ };
+ }
+
+ protected override bool OnCellPropertyChanged(Cell cell, string property, Dictionary<string, EvasObject> realizedView)
+ {
+ if (property == TextCell.TextProperty.PropertyName ||
+ property == TextCell.TextColorProperty.PropertyName ||
+ property == TextCell.DetailProperty.PropertyName ||
+ property == TextCell.DetailColorProperty.PropertyName)
+ {
+ return true;
+ }
+ return base.OnCellPropertyChanged(cell, property, realizedView);
+ }
+ }
+
+ internal class GroupCellTextRenderer : TextCellRenderer
+ {
+
+ public GroupCellTextRenderer() : this("group_index")
+ {
+ DetailPart = "elm.text.end";
+ }
+ protected GroupCellTextRenderer(string style) : base(style) { }
+ }
+}