/// <summary>
        /// Adds a child at the given index.
        /// </summary>
        /// <param name="parent">The parent view.</param>
        /// <param name="child">The child view.</param>
        /// <param name="index">The index.</param>
        public void AddView(DependencyObject parent, DependencyObject child, int index)
        {
            var span = (Span)parent;

            var inlineChild = child as Inline;

            if (inlineChild == null)
            {
                inlineChild = new InlineUIContainer
                {
                    Child = (UIElement)child,
                };
            }

#if WINDOWS_UWP
            span.Inlines.Insert(index, inlineChild);

            var parentUIElement = AccessibilityHelper.GetParentElementFromTextElement(span);
            if (parentUIElement != null)
            {
                AccessibilityHelper.OnChildAdded(parentUIElement, child);
            }
#else
            ((IList)span.Inlines).Insert(index, inlineChild);
#endif
        }
Example #2
0
        void IViewParentManager.AddView(DependencyObject parent, DependencyObject child, int index)
        {
            var element = (TFrameworkElement)parent;

            AddView(element, child, index);
#if WINDOWS_UWP
            AccessibilityHelper.OnChildAdded(element, child);
#endif
        }
Example #3
0
        void IViewParentManager.AddView(object parent, object child, int index)
        {
            var element          = (TFrameworkElement)parent;
            var dependencyObject = ViewConversion.GetDependencyObject(child);

            AddView(element, dependencyObject, index);
#if WINDOWS_UWP
            AccessibilityHelper.OnChildAdded(element, dependencyObject);
#endif
        }