using System.ComponentModel; namespace Xamarin.Forms.PlatformConfiguration.TizenSpecific { using FormsElement = Forms.VisualElement; public static class VisualElement { 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(string), 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); } public static void SetStyle(BindableObject element, string value) { element.SetValue(StyleProperty, value); } public static string GetStyle(this IPlatformElementConfiguration config) { return GetStyle(config.Element); } public static IPlatformElementConfiguration SetStyle(this IPlatformElementConfiguration config, string value) { 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 config) { return IsFocusAllowed(config.Element); } public static IPlatformElementConfiguration SetFocusAllowed(this IPlatformElementConfiguration config, bool value) { SetFocusAllowed(config.Element, value); return config; } [EditorBrowsable(EditorBrowsableState.Never)] public static string GetNextFocusDirection(BindableObject element) { return (string)element.GetValue(NextFocusDirectionProperty); } [EditorBrowsable(EditorBrowsableState.Never)] public static void SetNextFocusDirection(BindableObject element, string value) { element.SetValue(NextFocusDirectionProperty, value); } [EditorBrowsable(EditorBrowsableState.Never)] public static string GetNextFocusDirection(this IPlatformElementConfiguration config) { return GetNextFocusDirection(config.Element); } [EditorBrowsable(EditorBrowsableState.Never)] public static IPlatformElementConfiguration SetNextFocusDirection(this IPlatformElementConfiguration config, string value) { SetNextFocusDirection(config.Element, value); return config; } public static IPlatformElementConfiguration MoveFocusUp(this IPlatformElementConfiguration config) { SetNextFocusDirection(config.Element, FocusDirection.Up); return config; } public static IPlatformElementConfiguration MoveFocusDown(this IPlatformElementConfiguration config) { SetNextFocusDirection(config.Element, FocusDirection.Down); return config; } public static IPlatformElementConfiguration MoveFocusLeft(this IPlatformElementConfiguration config) { SetNextFocusDirection(config.Element, FocusDirection.Left); return config; } public static IPlatformElementConfiguration MoveFocusRight(this IPlatformElementConfiguration config) { SetNextFocusDirection(config.Element, FocusDirection.Right); return config; } public static IPlatformElementConfiguration MoveFocusBack(this IPlatformElementConfiguration config) { SetNextFocusDirection(config.Element, FocusDirection.Back); return config; } public static IPlatformElementConfiguration MoveFocusForward(this IPlatformElementConfiguration 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 config) { return GetNextFocusUpView(config.Element); } public static IPlatformElementConfiguration SetNextFocusUpView(this IPlatformElementConfiguration 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 config) { return GetNextFocusDownView(config.Element); } public static IPlatformElementConfiguration SetNextFocusDownView(this IPlatformElementConfiguration 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 config) { return GetNextFocusLeftView(config.Element); } public static IPlatformElementConfiguration SetNextFocusLeftView(this IPlatformElementConfiguration 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 config) { return GetNextFocusRightView(config.Element); } public static IPlatformElementConfiguration SetNextFocusRightView(this IPlatformElementConfiguration 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 config) { return GetNextFocusBackView(config.Element); } public static IPlatformElementConfiguration SetNextFocusBackView(this IPlatformElementConfiguration 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 config) { return GetNextFocusForwardView(config.Element); } public static IPlatformElementConfiguration SetNextFocusForwardView(this IPlatformElementConfiguration config, View value) { SetNextFocusForwardView(config.Element, value); return config; } static void OnNextFocusDirectionPropertyChanged(BindableObject bindable, object oldvalue, object newvalue) { bindable.SetValue(NextFocusDirectionProperty, FocusDirection.None); } } }