Class NavBarBindings
- Namespace
- Nalu
- Assembly
- Nalu.Maui.Scaffold.dll
The code-behind counterpart of NavBarBindingExtension: builds bindings to the ScaffoldNavBarContext of the page a given element belongs to.
public static class NavBarBindings
- Inheritance
-
NavBarBindings
- Inherited Members
Remarks
The element the binding will be applied to is passed in: it is what the page is resolved FROM, so the binding reads that element's own page — correct while two pages are on screen.
label.SetBinding(Label.TextProperty, NavBarBindings.Create(label, "Title"));
Single-segment paths compile to a typed binding (no reflection, trimming/AOT-safe); deeper
paths such as CurrentPage.BindingContext.SomeCommand are evaluated by reflection.
Methods
Create(Element, string, BindingMode, IValueConverter?, object?, string?)
Builds a binding into the ScaffoldNavBarContext of the page
target belongs to — page content through its page, bar content (and a
hosted title view) through the bar it is mounted in. Correct while two pages are on
screen during a transition.
public static BindingBase Create(Element target, string path = ".", BindingMode mode = BindingMode.Default, IValueConverter? converter = null, object? converterParameter = null, string? stringFormat = null)
Parameters
targetElementThe element the binding will be applied to.
pathstringThe path within the context ("." binds the context itself).
modeBindingModeThe binding mode.
converterIValueConverterThe converter.
converterParameterobjectThe converter parameter.
stringFormatstringThe string format.
Returns
Remarks
The target need not be parented yet: the context resolves when it enters the tree, and re-resolves if it is moved. Paths naming a context property compile to a typed binding; deeper paths are evaluated by reflection.