summaryrefslogtreecommitdiff
path: root/Xamarin.Forms.Core
diff options
context:
space:
mode:
authorKangho Hur <kangho.hur@samsung.com>2017-04-13 15:51:26 +0900
committerKangho Hur <kangho.hur@samsung.com>2017-07-10 11:11:22 +0900
commitca3b6f0f0954199156b20d88856f3c9459875a10 (patch)
treed406c642fdd4eacb0148b341726be9e795ec2bce /Xamarin.Forms.Core
parentc6396783714ac901c2908381cde8d0daefe5c592 (diff)
downloadxamarin-forms-ca3b6f0f0954199156b20d88856f3c9459875a10.tar.gz
xamarin-forms-ca3b6f0f0954199156b20d88856f3c9459875a10.tar.bz2
xamarin-forms-ca3b6f0f0954199156b20d88856f3c9459875a10.zip
Add Focus related properties for VE
TASK=TCAPI-2264 - Make sure that all these API should be invoked after all renderers are created. (e.g. use it inside Page.OnAppearing()) Change-Id: Ie441a067d5a7b94af120985b0a691fad6ce8250f
Diffstat (limited to 'Xamarin.Forms.Core')
-rw-r--r--Xamarin.Forms.Core/PlatformConfiguration/TizenSpecific/FocusDirection.cs16
-rw-r--r--Xamarin.Forms.Core/PlatformConfiguration/TizenSpecific/VisualElement.cs234
-rw-r--r--Xamarin.Forms.Core/Xamarin.Forms.Core.csproj1
3 files changed, 250 insertions, 1 deletions
diff --git a/Xamarin.Forms.Core/PlatformConfiguration/TizenSpecific/FocusDirection.cs b/Xamarin.Forms.Core/PlatformConfiguration/TizenSpecific/FocusDirection.cs
new file mode 100644
index 00000000..b4f15e12
--- /dev/null
+++ b/Xamarin.Forms.Core/PlatformConfiguration/TizenSpecific/FocusDirection.cs
@@ -0,0 +1,16 @@
+using System.ComponentModel;
+
+namespace Xamarin.Forms.PlatformConfiguration.TizenSpecific
+{
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public enum FocusDirection
+ {
+ None,
+ Back,
+ Forward,
+ Up,
+ Down,
+ Right,
+ Left
+ }
+} \ No newline at end of file
diff --git a/Xamarin.Forms.Core/PlatformConfiguration/TizenSpecific/VisualElement.cs b/Xamarin.Forms.Core/PlatformConfiguration/TizenSpecific/VisualElement.cs
index 7eb4c718..40c7d75e 100644
--- a/Xamarin.Forms.Core/PlatformConfiguration/TizenSpecific/VisualElement.cs
+++ b/Xamarin.Forms.Core/PlatformConfiguration/TizenSpecific/VisualElement.cs
@@ -1,3 +1,5 @@
+using System.ComponentModel;
+
namespace Xamarin.Forms.PlatformConfiguration.TizenSpecific
{
using FormsElement = Forms.VisualElement;
@@ -5,6 +7,23 @@ namespace Xamarin.Forms.PlatformConfiguration.TizenSpecific
{
public static readonly BindableProperty StyleProperty = BindableProperty.Create("ThemeStyle", typeof(string), typeof(VisualElement), default(string));
+ public static readonly BindableProperty IsFocusAllowedProperty = BindableProperty.Create("IsFocusAllowed", typeof(bool), typeof(VisualElement), true);
+
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public static readonly BindableProperty NextFocusDirectionProperty = BindableProperty.Create("NextFocusDirection", typeof(FocusDirection), typeof(VisualElement), FocusDirection.None, propertyChanged: OnNextFocusDirectionPropertyChanged);
+
+ public static readonly BindableProperty NextFocusUpViewProperty = BindableProperty.Create("NextFocusUpView", typeof(View), typeof(VisualElement), default(View));
+
+ public static readonly BindableProperty NextFocusDownViewProperty = BindableProperty.Create("NextFocusDownView", typeof(View), typeof(VisualElement), default(View));
+
+ public static readonly BindableProperty NextFocusLeftViewProperty = BindableProperty.Create("NextFocusLeftView", typeof(View), typeof(VisualElement), default(View));
+
+ public static readonly BindableProperty NextFocusRightViewProperty = BindableProperty.Create("NextFocusRightView", typeof(View), typeof(VisualElement), default(View));
+
+ public static readonly BindableProperty NextFocusBackViewProperty = BindableProperty.Create("NextFocusBackView", typeof(View), typeof(VisualElement), default(View));
+
+ public static readonly BindableProperty NextFocusForwardViewProperty = BindableProperty.Create("NextFocusForwardView", typeof(View), typeof(VisualElement), default(View));
+
public static string GetStyle(BindableObject element)
{
return (string)element.GetValue(StyleProperty);
@@ -25,5 +44,218 @@ namespace Xamarin.Forms.PlatformConfiguration.TizenSpecific
SetStyle(config.Element, value);
return config;
}
+
+ public static bool IsFocusAllowed(BindableObject element)
+ {
+ return (bool)element.GetValue(IsFocusAllowedProperty);
+ }
+
+ public static void SetFocusAllowed(BindableObject element, bool value)
+ {
+ element.SetValue(IsFocusAllowedProperty, value);
+ }
+
+ public static bool IsFocusAllowed(this IPlatformElementConfiguration<Tizen, FormsElement> config)
+ {
+ return IsFocusAllowed(config.Element);
+ }
+
+ public static IPlatformElementConfiguration<Tizen, FormsElement> SetFocusAllowed(this IPlatformElementConfiguration<Tizen, FormsElement> config, bool value)
+ {
+ SetFocusAllowed(config.Element, value);
+ return config;
+ }
+
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public static FocusDirection GetNextFocusDirection(BindableObject element)
+ {
+ return (FocusDirection)element.GetValue(NextFocusDirectionProperty);
+ }
+
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public static void SetNextFocusDirection(BindableObject element, FocusDirection value)
+ {
+ element.SetValue(NextFocusDirectionProperty, value);
+ }
+
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public static FocusDirection GetNextFocusDirection(this IPlatformElementConfiguration<Tizen, FormsElement> config)
+ {
+ return GetNextFocusDirection(config.Element);
+ }
+
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public static IPlatformElementConfiguration<Tizen, FormsElement> SetNextFocusDirection(this IPlatformElementConfiguration<Tizen, FormsElement> config, FocusDirection value)
+ {
+ SetNextFocusDirection(config.Element, value);
+ return config;
+ }
+
+ public static IPlatformElementConfiguration<Tizen, FormsElement> MoveFocusUp(this IPlatformElementConfiguration<Tizen, FormsElement> config)
+ {
+ SetNextFocusDirection(config.Element, FocusDirection.Up);
+ return config;
+ }
+
+ public static IPlatformElementConfiguration<Tizen, FormsElement> MoveFocusDown(this IPlatformElementConfiguration<Tizen, FormsElement> config)
+ {
+ SetNextFocusDirection(config.Element, FocusDirection.Down);
+ return config;
+ }
+
+ public static IPlatformElementConfiguration<Tizen, FormsElement> MoveFocusLeft(this IPlatformElementConfiguration<Tizen, FormsElement> config)
+ {
+ SetNextFocusDirection(config.Element, FocusDirection.Left);
+ return config;
+ }
+
+ public static IPlatformElementConfiguration<Tizen, FormsElement> MoveFocusRight(this IPlatformElementConfiguration<Tizen, FormsElement> config)
+ {
+ SetNextFocusDirection(config.Element, FocusDirection.Right);
+ return config;
+ }
+
+ public static IPlatformElementConfiguration<Tizen, FormsElement> MoveFocusBack(this IPlatformElementConfiguration<Tizen, FormsElement> config)
+ {
+ SetNextFocusDirection(config.Element, FocusDirection.Back);
+ return config;
+ }
+
+ public static IPlatformElementConfiguration<Tizen, FormsElement> MoveFocusForward(this IPlatformElementConfiguration<Tizen, FormsElement> config)
+ {
+ SetNextFocusDirection(config.Element, FocusDirection.Forward);
+ return config;
+ }
+
+ public static View GetNextFocusUpView(BindableObject element)
+ {
+ return (View)element.GetValue(NextFocusUpViewProperty);
+ }
+
+ public static void SetNextFocusUpView(BindableObject element, View value)
+ {
+ element.SetValue(NextFocusUpViewProperty, value);
+ }
+
+ public static View GetNextFocusUpView(this IPlatformElementConfiguration<Tizen, FormsElement> config)
+ {
+ return GetNextFocusUpView(config.Element);
+ }
+
+ public static IPlatformElementConfiguration<Tizen, FormsElement> SetNextFocusUpView(this IPlatformElementConfiguration<Tizen, FormsElement> config, View value)
+ {
+ SetNextFocusUpView(config.Element, value);
+ return config;
+ }
+
+ public static View GetNextFocusDownView(BindableObject element)
+ {
+ return (View)element.GetValue(NextFocusDownViewProperty);
+ }
+
+ public static void SetNextFocusDownView(BindableObject element, View value)
+ {
+ element.SetValue(NextFocusDownViewProperty, value);
+ }
+
+ public static View GetNextFocusDownView(this IPlatformElementConfiguration<Tizen, FormsElement> config)
+ {
+ return GetNextFocusDownView(config.Element);
+ }
+
+ public static IPlatformElementConfiguration<Tizen, FormsElement> SetNextFocusDownView(this IPlatformElementConfiguration<Tizen, FormsElement> config, View value)
+ {
+ SetNextFocusDownView(config.Element, value);
+ return config;
+ }
+
+ public static View GetNextFocusLeftView(BindableObject element)
+ {
+ return (View)element.GetValue(NextFocusLeftViewProperty);
+ }
+
+ public static void SetNextFocusLeftView(BindableObject element, View value)
+ {
+ element.SetValue(NextFocusLeftViewProperty, value);
+ }
+
+ public static View GetNextFocusLeftView(this IPlatformElementConfiguration<Tizen, FormsElement> config)
+ {
+ return GetNextFocusLeftView(config.Element);
+ }
+
+ public static IPlatformElementConfiguration<Tizen, FormsElement> SetNextFocusLeftView(this IPlatformElementConfiguration<Tizen, FormsElement> config, View value)
+ {
+ SetNextFocusLeftView(config.Element, value);
+ return config;
+ }
+
+ public static View GetNextFocusRightView(BindableObject element)
+ {
+ return (View)element.GetValue(NextFocusRightViewProperty);
+ }
+
+ public static void SetNextFocusRightView(BindableObject element, View value)
+ {
+ element.SetValue(NextFocusRightViewProperty, value);
+ }
+
+ public static View GetNextFocusRightView(this IPlatformElementConfiguration<Tizen, FormsElement> config)
+ {
+ return GetNextFocusRightView(config.Element);
+ }
+
+ public static IPlatformElementConfiguration<Tizen, FormsElement> SetNextFocusRightView(this IPlatformElementConfiguration<Tizen, FormsElement> config, View value)
+ {
+ SetNextFocusRightView(config.Element, value);
+ return config;
+ }
+
+ public static View GetNextFocusBackView(BindableObject element)
+ {
+ return (View)element.GetValue(NextFocusBackViewProperty);
+ }
+
+ public static void SetNextFocusBackView(BindableObject element, View value)
+ {
+ element.SetValue(NextFocusBackViewProperty, value);
+ }
+
+ public static View GetNextFocusBackView(this IPlatformElementConfiguration<Tizen, FormsElement> config)
+ {
+ return GetNextFocusBackView(config.Element);
+ }
+
+ public static IPlatformElementConfiguration<Tizen, FormsElement> SetNextFocusBackView(this IPlatformElementConfiguration<Tizen, FormsElement> config, View value)
+ {
+ SetNextFocusBackView(config.Element, value);
+ return config;
+ }
+
+ public static View GetNextFocusForwardView(BindableObject element)
+ {
+ return (View)element.GetValue(NextFocusForwardViewProperty);
+ }
+
+ public static void SetNextFocusForwardView(BindableObject element, View value)
+ {
+ element.SetValue(NextFocusForwardViewProperty, value);
+ }
+
+ public static View GetNextFocusForwardView(this IPlatformElementConfiguration<Tizen, FormsElement> config)
+ {
+ return GetNextFocusForwardView(config.Element);
+ }
+
+ public static IPlatformElementConfiguration<Tizen, FormsElement> SetNextFocusForwardView(this IPlatformElementConfiguration<Tizen, FormsElement> config, View value)
+ {
+ SetNextFocusForwardView(config.Element, value);
+ return config;
+ }
+
+ static void OnNextFocusDirectionPropertyChanged(BindableObject bindable, object oldvalue, object newvalue)
+ {
+ bindable.SetValue(NextFocusDirectionProperty, FocusDirection.None);
+ }
}
-}
+} \ No newline at end of file
diff --git a/Xamarin.Forms.Core/Xamarin.Forms.Core.csproj b/Xamarin.Forms.Core/Xamarin.Forms.Core.csproj
index 65e68711..fe60e77d 100644
--- a/Xamarin.Forms.Core/Xamarin.Forms.Core.csproj
+++ b/Xamarin.Forms.Core/Xamarin.Forms.Core.csproj
@@ -110,6 +110,7 @@
<Compile Include="PlatformConfiguration\iOSSpecific\UIStatusBarAnimation.cs" />
<Compile Include="PlatformConfiguration\iOSSpecific\UpdateMode.cs" />
<Compile Include="PlatformConfiguration\iOSSpecific\VisualElement.cs" />
+ <Compile Include="PlatformConfiguration\TizenSpecific\FocusDirection.cs" />
<Compile Include="PlatformConfiguration\TizenSpecific\StyleValues.cs" />
<Compile Include="PlatformConfiguration\TizenSpecific\VisualElement.cs" />
<Compile Include="PlatformConfiguration\TizenSpecific\Page.cs" />