internal static void Cleanup(this VisualElement self) { if (self == null) { throw new ArgumentNullException("self"); } IVisualElementRenderer renderer = Platform.GetRenderer(self); foreach (Element element in self.Descendants()) { var visual = element as VisualElement; if (visual == null) { continue; } IVisualElementRenderer childRenderer = Platform.GetRenderer(visual); if (childRenderer != null) { ((Gtk.Widget)childRenderer).Destroy(); Platform.SetRenderer(visual, null); } } if (renderer != null) { ((Gtk.Widget)renderer).Destroy(); Platform.SetRenderer(self, null); } }
public static void Cleanup(this VisualElement self) { if (self == null) { throw new ArgumentNullException("self"); } IVisualElementRenderer renderer = Platform.GTK.Platform.GetRenderer(self); foreach (Element element in self.Descendants()) { var visual = element as VisualElement; if (visual == null) { continue; } IVisualElementRenderer childRenderer = Platform.GTK.Platform.GetRenderer(visual); if (childRenderer != null) { childRenderer.Dispose(); Platform.GTK.Platform.SetRenderer(visual, null); } } if (renderer != null) { renderer.Dispose(); Platform.GTK.Platform.SetRenderer(self, null); } }
internal static void Cleanup(this VisualElement self) { if (self == null) { throw new ArgumentNullException(nameof(self)); } IVisualElementRenderer renderer = Platform.GetRenderer(self); foreach (Element element in self.Descendants()) { if (!(element is VisualElement visual)) { continue; } IVisualElementRenderer childRenderer = Platform.GetRenderer(visual); if (childRenderer != null) { childRenderer.Dispose(); Platform.SetRenderer(visual, null); } } if (renderer != null) { renderer.Dispose(); Platform.SetRenderer(self, null); } }
public static void DisposeModelAndChildrenRenderers(this VisualElement view) { IVisualElementRenderer renderer; foreach (var child in view.Descendants().OfType <VisualElement>()) { renderer = XFPlatform.GetRenderer(child); XFPlatform.SetRenderer(child, null); if (renderer == null) { continue; } renderer.NativeView.RemoveFromSuperview(); renderer.Dispose(); } renderer = XFPlatform.GetRenderer(view); if (renderer != null) { renderer.NativeView.RemoveFromSuperview(); renderer.Dispose(); } XFPlatform.SetRenderer(view, null); }
public List <NSObject> GetAccessibilityElements() { if (Container == null || Element == null) { return(null); } var children = Element.Descendants(); SortedDictionary <int, List <VisualElement> > tabIndexes = null; List <NSObject> views = new List <NSObject>(); foreach (var child in children) { if (!(child is VisualElement ve)) { continue; } tabIndexes = ve.GetSortedTabIndexesOnParentPage(out _); break; } if (tabIndexes == null) { return(null); } foreach (var idx in tabIndexes?.Keys) { var tabGroup = tabIndexes[idx]; foreach (var child in tabGroup) { if (child is Layout || !( child is VisualElement ve && ve.IsTabStop && AutomationProperties.GetIsInAccessibleTree(ve) != false && // accessible == true ve.GetRenderer().NativeView is ITabStop tabStop) ) { continue; } var thisControl = tabStop.TabStop; if (thisControl == null) { continue; } if (views.Contains(thisControl)) { break; // we've looped to the beginning } views.Add(thisControl); } } return(views); }
// TODO MAUI Make this work against IVIEW internal static void Cleanup(this VisualElement self) { if (self == null) { throw new ArgumentNullException("self"); } IViewHandler handler = self.Handler; foreach (Element element in self.Descendants()) { var visual = element as VisualElement; if (visual == null) { continue; } visual.Handler = null; } self.Handler = null; }