Class ScaffoldElementExtensions
- Namespace
- Nalu
- Assembly
- Nalu.Maui.Scaffold.dll
Element-tree helpers for reaching the owning Scaffold.
public static class ScaffoldElementExtensions
- Inheritance
-
ScaffoldElementExtensions
- Inherited Members
Methods
GetScaffold(IElement)
Walks the logical parents up to the owning Scaffold.
public static Scaffold GetScaffold(this IElement element)
Parameters
elementIElement
Returns
Exceptions
- InvalidOperationException
The element is not hosted in a Scaffold. Note that the scaffold is only reachable AFTER the element has been parented — calling this from a constructor always throws; use it from event handlers, commands, or lifecycle callbacks instead (or use GetScaffoldOrDefault(IElement) to probe).
GetScaffoldOrDefault(IElement)
Walks the logical parents up to the owning Scaffold, or null when none is reachable. When the walk reaches the application (including calling this ON the application itself — Application is an IElement), the first scaffold-hosted window's scaffold is returned instead: the app-level lookup and the element-level walk are ONE pair of methods on purpose (no conflicting overloads).
public static Scaffold? GetScaffoldOrDefault(this IElement element)
Parameters
elementIElement