diff --git a/Xamarin.Forms.Platform.Tizen/PopupManager.cs b/Xamarin.Forms.Platform.Tizen/PopupManager.cs index c49be820a..cbfa796ad 100644 --- a/Xamarin.Forms.Platform.Tizen/PopupManager.cs +++ b/Xamarin.Forms.Platform.Tizen/PopupManager.cs @@ -142,10 +142,12 @@ namespace Xamarin.Forms.Platform.Tizen var destruction = new Native.Button(alert) { Text = arguments.Destruction, - Style = ButtonStyle.Text, - TextColor = EColor.Red, AlignmentX = -1 }; + destruction.SetWatchTextStyle(); + //TextColor should be set after applying style + destruction.TextColor = EColor.Red; + destruction.Clicked += (s, evt) => { arguments.SetResult(arguments.Destruction); @@ -160,9 +162,10 @@ namespace Xamarin.Forms.Platform.Tizen var button = new Native.Button(alert) { Text = buttonName, - Style = ButtonStyle.Text, AlignmentX = -1 }; + button.SetWatchTextStyle(); + button.Clicked += (s, evt) => { arguments.SetResult(buttonName); diff --git a/Xamarin.Forms.Platform.Tizen/Renderers/EditorRenderer.cs b/Xamarin.Forms.Platform.Tizen/Renderers/EditorRenderer.cs index 5e4e378e8..fbfb56b5b 100644 --- a/Xamarin.Forms.Platform.Tizen/Renderers/EditorRenderer.cs +++ b/Xamarin.Forms.Platform.Tizen/Renderers/EditorRenderer.cs @@ -114,7 +114,7 @@ namespace Xamarin.Forms.Platform.Tizen void UpdateText() { - Control.Text = Element.Text; + Control.Text = Element.Text ?? ""; if (!Control.IsFocused) { Control.MoveCursorEnd(); diff --git a/Xamarin.Forms.Platform.Tizen/Renderers/EntryRenderer.cs b/Xamarin.Forms.Platform.Tizen/Renderers/EntryRenderer.cs index fe44188b4..4be372b9c 100644 --- a/Xamarin.Forms.Platform.Tizen/Renderers/EntryRenderer.cs +++ b/Xamarin.Forms.Platform.Tizen/Renderers/EntryRenderer.cs @@ -116,7 +116,7 @@ namespace Xamarin.Forms.Platform.Tizen void UpdateText() { - Control.Text = Element.Text; + Control.Text = Element.Text ?? ""; if (!Control.IsFocused) { Control.MoveCursorEnd(); @@ -259,7 +259,7 @@ namespace Xamarin.Forms.Platform.Tizen int GetSelectionStart() { - int start = Element.Text.Length; + int start = Element.Text?.Length ?? 0; int cursorPosition = Element.CursorPosition; if (Element.IsSet(Entry.CursorPositionProperty)) diff --git a/Xamarin.Forms.Platform.Tizen/Renderers/LabelRenderer.cs b/Xamarin.Forms.Platform.Tizen/Renderers/LabelRenderer.cs index cfdc7f4ca..4a10a20d1 100644 --- a/Xamarin.Forms.Platform.Tizen/Renderers/LabelRenderer.cs +++ b/Xamarin.Forms.Platform.Tizen/Renderers/LabelRenderer.cs @@ -84,7 +84,7 @@ namespace Xamarin.Forms.Platform.Tizen void UpdateText() { - Control.Text = Element.Text; + Control.Text = Element.Text ?? ""; } void UpdateTextColor() diff --git a/Xamarin.Forms.Platform.Tizen/Renderers/RadioButtonRenderer.cs b/Xamarin.Forms.Platform.Tizen/Renderers/RadioButtonRenderer.cs index 470430cd5..711735c8b 100644 --- a/Xamarin.Forms.Platform.Tizen/Renderers/RadioButtonRenderer.cs +++ b/Xamarin.Forms.Platform.Tizen/Renderers/RadioButtonRenderer.cs @@ -71,7 +71,7 @@ namespace Xamarin.Forms.Platform.Tizen void UpdateText(bool isInitialized) { - _span.Text = Element.ContentAsString(); + _span.Text = Element.ContentAsString() ?? ""; if (!isInitialized) ApplyTextAndStyle(); } diff --git a/Xamarin.Forms.Platform.Tizen/Renderers/SearchBarRenderer.cs b/Xamarin.Forms.Platform.Tizen/Renderers/SearchBarRenderer.cs index 317688099..683a20575 100644 --- a/Xamarin.Forms.Platform.Tizen/Renderers/SearchBarRenderer.cs +++ b/Xamarin.Forms.Platform.Tizen/Renderers/SearchBarRenderer.cs @@ -175,7 +175,7 @@ namespace Xamarin.Forms.Platform.Tizen /// void TextPropertyHandler() { - Control.Text = Element.Text; + Control.Text = Element.Text ?? ""; } void UpdateKeyboard(bool initialize) diff --git a/Xamarin.Forms.Platform.Tizen/ThemeConstants.cs b/Xamarin.Forms.Platform.Tizen/ThemeConstants.cs index b130d9124..e419dfb6c 100644 --- a/Xamarin.Forms.Platform.Tizen/ThemeConstants.cs +++ b/Xamarin.Forms.Platform.Tizen/ThemeConstants.cs @@ -81,6 +81,7 @@ namespace Xamarin.Forms.Platform.Tizen { public const string PopupLeft = "popup/circle/left_delete"; public const string PopupRight = "popup/circle/right_check"; + public const string Text = "textbutton"; } } diff --git a/Xamarin.Forms.Platform.Tizen/ThemeManager.cs b/Xamarin.Forms.Platform.Tizen/ThemeManager.cs index fe5f34958..90aab4c08 100644 --- a/Xamarin.Forms.Platform.Tizen/ThemeManager.cs +++ b/Xamarin.Forms.Platform.Tizen/ThemeManager.cs @@ -235,6 +235,17 @@ namespace Xamarin.Forms.Platform.Tizen return button; } + public static EButton SetWatchTextStyle(this EButton button) + { + if (Device.Idiom != TargetIdiom.Watch) + { + Log.Error($"ToWatchPopupRightStyleButton is only supported on TargetIdiom.Watch : {0}", Device.Idiom); + return button; + } + button.Style = ThemeConstants.Button.Styles.Watch.Text; + return button; + } + public static bool SetIconPart(this EButton button, EvasObject content, bool preserveOldContent = false) { return button.SetPartContent(ThemeConstants.Button.Parts.Icon, content, preserveOldContent); @@ -273,6 +284,7 @@ namespace Xamarin.Forms.Platform.Tizen button.SetPartColor(ThemeConstants.Button.ColorClass.Effect, color); button.SetPartColor(ThemeConstants.Button.ColorClass.EffectPressed, color); } + #endregion #region Popup