Compatibility\iOS\Extensions\AccessibilityExtensions.cs (7)
16 public static void SetAccessibilityProperties(this NativeView nativeViewElement, Element element)
28 public static string SetAccessibilityHint(this NativeView Control, Element Element, string _defaultAccessibilityHint = null)
49 public static string SetAccessibilityLabel(this NativeView Control, Element Element, string _defaultAccessibilityLabel = null)
65 public static string SetAccessibilityHint(this UIBarItem Control, Element Element, string _defaultAccessibilityHint = null)
81 public static string SetAccessibilityLabel(this UIBarItem Control, Element Element, string _defaultAccessibilityLabel = null)
97 public static bool? SetIsAccessibilityElement(this NativeView Control, Element Element, bool? _defaultIsAccessibilityElement = null)
132 public static bool? SetAccessibilityElementsHidden(this NativeView Control, Element Element, bool? _defaultAccessibilityElementsHidden = null)
Element\Element.cs (90)
28 /// <description>An <see cref="Element" /> that occupies an area on the screen, has a visual appearance, and can obtain touch input.</description>
51 internal static readonly ReadOnlyCollection<Element> EmptyChildren = new ReadOnlyCollection<Element>(Array.Empty<Element>());
54 public static readonly BindableProperty AutomationIdProperty = BindableProperty.Create(nameof(AutomationId), typeof(string), typeof(Element), null);
57 public static readonly BindableProperty ClassIdProperty = BindableProperty.Create(nameof(ClassId), typeof(string), typeof(Element), null);
71 WeakReference<Element> _parentOverride;
75 IReadOnlyList<Element> _logicalChildrenReadonly;
77 IList<Element> _internalChildren;
162 internal IReadOnlyList<Element> LogicalChildrenInternal
171 private protected virtual IList<Element> LogicalChildrenInternalBackingStore
175 _internalChildren ??= new List<Element>();
182 public ReadOnlyCollection<Element> LogicalChildren =>
183 new ReadOnlyCollection<Element>(new TemporaryWrapper(LogicalChildrenInternal));
186 IReadOnlyList<Element> IElementController.LogicalChildren => LogicalChildrenInternal;
190 _logicalChildrenReadonly ??= new ReadOnlyCollection<Element>(LogicalChildrenInternalBackingStore);
194 /// Inserts an <see cref="Element"/> to the logical children at the specified index.
196 /// <param name="index">The zero-based index at which <see cref="Element"/> should be inserted.</param>
197 /// <param name="element">The <see cref="Element"/> to insert into the logical children.</param>
198 public void InsertLogicalChild(int index, Element element)
212 /// Adds an <see cref="Element"/> to the logical children.
214 /// <param name="element">The <see cref="Element"/> to add to the logical children.</param>
215 public void AddLogicalChild(Element element)
229 /// Removes the first occurrence of a specific <see cref="Element"/> from the logical children.
231 /// <param name="element">The <see cref="Element"/> to remove.</param>
234 /// otherwise, false. This method also returns false if <see cref="Element"/> is not found.
236 public bool RemoveLogicalChild(Element element)
256 /// Removes all child <see cref="Element"/>s.
273 internal bool RemoveLogicalChild(Element element, int index)
283 internal Element ParentOverride
291 if (_parentOverride.TryGetTarget(out var parent))
299 .CreateLogger<Element>()?
325 _parentOverride = new WeakReference<Element>(value);
335 WeakReference<Element> _realParent;
338 public Element RealParent
346 if (_realParent.TryGetTarget(out var parent))
354 .CreateLogger<Element>()?
365 _realParent = new WeakReference<Element>(value);
378 /// <summary>Gets or sets the parent <see cref="Element"/> of this element.</summary>
379 /// <value>The <see cref="Element"/> which should be the parent of this element.</value>
381 public Element Parent
387 void SetParent(Element value)
389 Element realParent = RealParent;
409 Application.Current?.FindMauiContext()?.CreateLogger<Element>()?.LogWarning($"{this} is already a child of {element}. Remove {this} from {element} before adding to {value}.");
577 SetChildInheritedBindingContext((Element)child, bc);
592 protected virtual void OnChildAdded(Element child)
601 foreach (Element element in child.Descendants())
612 protected virtual void OnChildRemoved(Element child, int oldLogicalIndex)
621 foreach (Element element in child.Descendants())
690 internal IEnumerable<Element> Descendants() =>
691 Descendants<Element>();
694 IEnumerable<Element> IElementController.Descendants() =>
695 Descendants<Element>();
698 where TElement : Element
700 var queue = new Queue<Element>(16);
705 IReadOnlyList<Element> children = queue.Dequeue().LogicalChildrenInternal;
708 Element child = children[i];
779 if (bindableObject != null && (bindableObject as Element)?.Parent == null)
799 internal virtual void SetChildInheritedBindingContext(Element child, object context)
804 internal IEnumerable<Element> VisibleDescendants()
806 var queue = new Queue<Element>(16);
811 IReadOnlyList<Element> children = queue.Dequeue().LogicalChildrenInternal;
898 var element = this;
908 void OnDescendantAdded(Element child)
914 void OnDescendantRemoved(Element child)
944 private protected virtual void OnParentChangingCore(Element oldParent, Element newParent)
1075 class TemporaryWrapper : IList<Element>
1077 IReadOnlyList<Element> _inner;
1079 public TemporaryWrapper(IReadOnlyList<Element> inner)
1084 Element IList<Element>.this[int index] { get => _inner[index]; set => throw new NotSupportedException(); }
1086 int ICollection<Element>.Count => _inner.Count;
1088 bool ICollection<Element>.IsReadOnly => true;
1090 void ICollection<Element>.Add(Element item) => throw new NotSupportedException();
1092 void ICollection<Element>.Clear() => throw new NotSupportedException();
1094 bool ICollection<Element>.Contains(Element item) => _inner.IndexOf(item) != -1;
1096 void ICollection<Element>.CopyTo(Element[] array, int arrayIndex) => throw new NotSupportedException();
1098 IEnumerator<Element> IEnumerable<Element>.GetEnumerator() => _inner.GetEnumerator();
1102 int IList<Element>.IndexOf(Element item) => _inner.IndexOf(item);
1104 void IList<Element>.Insert(int index, Element item) => throw new NotSupportedException();
1106 bool ICollection<Element>.Remove(Element item) => throw new NotSupportedException();
1108 void IList<Element>.RemoveAt(int index) => throw new NotSupportedException();
Properties\AssemblyInfo.cs (10)
165[assembly: StyleProperty("-maui-shell-background", typeof(Element), nameof(Shell.BackgroundColorProperty), PropertyOwnerType = typeof(Shell))]
166[assembly: StyleProperty("-maui-shell-disabled", typeof(Element), nameof(Shell.DisabledColorProperty), PropertyOwnerType = typeof(Shell))]
167[assembly: StyleProperty("-maui-shell-foreground", typeof(Element), nameof(Shell.ForegroundColorProperty), PropertyOwnerType = typeof(Shell))]
168[assembly: StyleProperty("-maui-shell-tabbar-background", typeof(Element), nameof(Shell.TabBarBackgroundColorProperty), PropertyOwnerType = typeof(Shell))]
169[assembly: StyleProperty("-maui-shell-tabbar-disabled", typeof(Element), nameof(Shell.TabBarDisabledColorProperty), PropertyOwnerType = typeof(Shell))]
170[assembly: StyleProperty("-maui-shell-tabbar-foreground", typeof(Element), nameof(Shell.TabBarForegroundColorProperty), PropertyOwnerType = typeof(Shell))]
171[assembly: StyleProperty("-maui-shell-tabbar-title", typeof(Element), nameof(Shell.TabBarTitleColorProperty), PropertyOwnerType = typeof(Shell))]
172[assembly: StyleProperty("-maui-shell-tabbar-unselected", typeof(Element), nameof(Shell.TabBarUnselectedColorProperty), PropertyOwnerType = typeof(Shell))]
173[assembly: StyleProperty("-maui-shell-title", typeof(Element), nameof(Shell.TitleColorProperty), PropertyOwnerType = typeof(Shell))]
174[assembly: StyleProperty("-maui-shell-unselected", typeof(Element), nameof(Shell.UnselectedColorProperty), PropertyOwnerType = typeof(Shell))]
RelativeBindingSource.cs (10)
74 internal async Task Apply(BindingExpression expression, Element relativeSourceTarget, BindableObject targetObject, BindableProperty targetProperty, SetterSpecificity specificity)
80 internal async Task Apply(TypedBindingBase binding, Element relativeSourceTarget, BindableObject targetObject, BindableProperty targetProperty, SetterSpecificity specificity)
86 private async Task Apply(IBindingAdapter bindingAdapter, Element relativeSourceTarget)
104 chain: new List<Element> { relativeSourceTarget },
117 Element currentElement,
119 List<Element> chain,
162 private bool ElementFitsAncestorTypeAndLevel(Element element, ref int level, ref object? lastPotentialBctx)
196 void SubscribeToAncestryChanges(List<Element> chain, bool includeBindingContext, bool rootIsSource);
212 public void SubscribeToAncestryChanges(List<Element> chain, bool includeBindingContext, bool rootIsSource)
229 public void SubscribeToAncestryChanges(List<Element> chain, bool includeBindingContext, bool rootIsSource)
Shell\Shell.cs (28)
120 if (bindable is Element element)
345 var element = (Element)bindable;
610 var item = (Element)bindable;
611 var source = item;
630 List<(IAppearanceObserver Observer, Element Pivot)> _appearanceObservers = new List<(IAppearanceObserver Observer, Element Pivot)>();
685 void IShellController.AddAppearanceObserver(IAppearanceObserver observer, Element pivot)
703 void UpdateToolbarAppearanceFeatures(Element pivot, ShellAppearance appearance)
739 void IShellController.AppearanceChanged(Element source, bool appearanceSet)
761 var pivot = Pivot;
763 Element target;
764 Element leaf;
794 void OnFlyoutItemSelected(Element element, bool platformInitiated) =>
797 void IShellController.OnFlyoutItemSelected(Element element) =>
800 Task IShellController.OnFlyoutItemSelectedAsync(Element element) =>
803 Task OnFlyoutItemSelectedAsync(Element element, bool platformInitiated)
1506 List<List<Element>> IShellController.GenerateFlyoutGrouping() =>
1559 bool ValidDefaultShellItem(Element child) => !(child is MenuShellItem);
1682 static void UpdateChecked(Element root, bool isChecked = true)
1791 Action<Element> observer,
1792 Element element = null,
1795 element = element ?? (Element)GetCurrentShellPage() ?? CurrentContent;
1819 ShellAppearance GetAppearanceForPivot(Element pivot)
1917 internal Element GetVisiblePage()
1949 Element WalkToPage(Element element)