Пример #1
0
        /// <summary>
        /// Initializes the standard properties for this framework element.
        /// </summary>
        public static void Initialize(IFrameworkElement e)
        {
#if NET46
            // These properties have moved to dependency properties
            // on Uno.UI, tests still depend on it.
            e.HorizontalAlignment = HorizontalAlignment.Stretch;
            e.VerticalAlignment   = VerticalAlignment.Stretch;
            e.Width    = e.Height = double.NaN;
            e.MinWidth = e.MinHeight = 0;
            e.MaxWidth = e.MaxHeight = double.PositiveInfinity;
#endif
            if (FeatureConfiguration.FrameworkElement.UseLegacyApplyStylePhase)
            {
                e.Style = Xaml.Style.DefaultStyleForType(e.GetType());
            }

            if (
                !FeatureConfiguration.UIElement.UseLegacyClipping &&
                e is UIElement uiElement
                )
            {
#if __IOS__
                uiElement.ClipsToBounds       = false;
                uiElement.Layer.MasksToBounds = false;
                uiElement.Layer.MaskedCorners = (CoreAnimation.CACornerMask) 0;
#endif
            }

#if XAMARIN_ANDROID
            if (Debugger.IsAttached)
            {
                (e as View).ContentDescription = e.GetType().ToString();
            }
#endif
        }
Пример #2
0
        /// <summary>
        /// Initializes the standard properties for this framework element.
        /// </summary>
        public static void Initialize(IFrameworkElement e)
        {
            if (FeatureConfiguration.FrameworkElement.UseLegacyApplyStylePhase)
            {
                e.Style = Xaml.Style.DefaultStyleForType(e.GetType());
            }

            if (e is UIElement uiElement)
            {
#if __IOS__
                uiElement.ClipsToBounds       = false;
                uiElement.Layer.MasksToBounds = false;
                uiElement.Layer.MaskedCorners = (CoreAnimation.CACornerMask) 0;
#endif
            }

#if __ANDROID__
            if (e is View view)
            {
                // TODO:
                // This causes Android to cycle through every visible IFrameworkElement every time the accessibility focus is changed
                // and calls the overridden InitializeAccessibilityNodeInfo method.
                // This could become a performance problem (due to interop) in complex UIs (only if TalkBack is enabled).
                // A possible optimization could be to set it to ImportantForAccessibility.No if FrameworkElement.CreateAutomationPeer returns null.
                view.ImportantForAccessibility = Android.Views.ImportantForAccessibility.Yes;
            }
#endif
        }
Пример #3
0
        /// <summary>
        /// Initializes the standard properties for this framework element.
        /// </summary>
        public static void Initialize(IFrameworkElement e)
        {
#if NET46
            // These properties have moved to dependency properties
            // on Uno.UI, tests still depend on it.
            e.HorizontalAlignment = HorizontalAlignment.Stretch;
            e.VerticalAlignment   = VerticalAlignment.Stretch;
            e.Width    = e.Height = double.NaN;
            e.MinWidth = e.MinHeight = 0;
            e.MaxWidth = e.MaxHeight = double.PositiveInfinity;
#endif
            if (FeatureConfiguration.FrameworkElement.UseLegacyApplyStylePhase)
            {
                e.Style = Xaml.Style.DefaultStyleForType(e.GetType());
            }

            if (
                !FeatureConfiguration.UIElement.UseLegacyClipping &&
                e is UIElement uiElement
                )
            {
#if __IOS__
                uiElement.ClipsToBounds       = false;
                uiElement.Layer.MasksToBounds = false;
                uiElement.Layer.MaskedCorners = (CoreAnimation.CACornerMask) 0;
#endif
            }

#if __ANDROID__
            if (e is View view)
            {
                // TODO:
                // This causes Android to cycle through every visible IFrameworkElement every time the accessibility focus is changed
                // and calls the overriden InitializeAccessibilityNodeInfo method.
                // This could become a performance problem (due to interop) in complex UIs (only if TalkBack is enabled).
                // A possible optimization could be to set it to ImportantForAccessibility.No if FrameworkElement.CreateAutomationPeer returns null.
                view.ImportantForAccessibility = Android.Views.ImportantForAccessibility.Yes;
            }
#endif
        }