Exemplo n.º 1
0
        public static IVisualElementRenderer CreateRenderer(VisualElement element)
        {
            if (element == null)
            {
                throw new ArgumentNullException(nameof(element));
            }

            IVisualElementRenderer renderer = null;

            // temporary hack to fix the following issues
            // https://github.com/xamarin/Xamarin.Forms/issues/13261
            // https://github.com/xamarin/Xamarin.Forms/issues/12484
            if (element is RadioButton tv && tv.ResolveControlTemplate() != null)
            {
                renderer = new DefaultRenderer();
            }

            if (renderer == null)
            {
                renderer = Registrar.Registered.GetHandlerForObject <IVisualElementRenderer>(element) ??
                           new DefaultRenderer();
            }

            renderer.SetElement(element);
            return(renderer);
        }
Exemplo n.º 2
0
        public static IVisualElementRenderer CreateRenderer(VisualElement element)
        {
            IVisualElementRenderer renderer = null;

            if (element is TemplatedView tv && tv.ResolveControlTemplate() != null)
            {
                renderer = new DefaultRenderer();
            }

            if (renderer == null)
            {
                renderer = Internals.Registrar.Registered.GetHandlerForObject <IVisualElementRenderer>(element) ?? new DefaultRenderer();
            }

            renderer.SetElement(element);
            return(renderer);
        }
Exemplo n.º 3
0
        internal static IVisualElementRenderer CreateRenderer(VisualElement element, Context context)
        {
            IVisualElementRenderer renderer = null;

            // temporary hack to fix the following issues
            // https://github.com/xamarin/Xamarin.Forms/issues/13261
            // https://github.com/xamarin/Xamarin.Forms/issues/12484
            if (element is RadioButton tv && tv.ResolveControlTemplate() != null)
            {
                renderer = new DefaultRenderer(context);
            }

            if (renderer == null)
            {
                renderer = Registrar.Registered.GetHandlerForObject <IVisualElementRenderer>(element, context)
                           ?? new DefaultRenderer(context);
            }

            renderer.SetElement(element);
            return(renderer);
        }
Exemplo n.º 4
0
        public static IVisualElementRenderer CreateRenderer(VisualElement element)
        {
            if (element == null)
            {
                throw new ArgumentNullException(nameof(element));
            }

            IVisualElementRenderer renderer = null;

            if (element is TemplatedView tv && tv.ResolveControlTemplate() != null)
            {
                renderer = new DefaultRenderer();
            }

            if (renderer == null)
            {
                renderer = Registrar.Registered.GetHandlerForObject <IVisualElementRenderer>(element) ??
                           new DefaultRenderer();
            }

            renderer.SetElement(element);
            return(renderer);
        }