Class KeyboardBindings
- Namespace
- Nalu
- Assembly
- Nalu.Maui.Scaffold.dll
The code-behind counterpart of KeyboardBindingExtension: builds bindings to the ambient ScaffoldKeyboardState from anywhere inside the scaffold's element tree.
public static class KeyboardBindings
- Inheritance
-
KeyboardBindings
- Inherited Members
Remarks
// String path (same reflection semantics as {nalu:KeyboardBinding}):
banner.SetBinding(VisualElement.IsVisibleProperty, KeyboardBindings.Create("IsVisible", converter: new InvertedBoolConverter()));
// Fully typed and compiled (trimming/AOT-safe):
spacer.SetBinding(VisualElement.HeightRequestProperty,
static (Scaffold s) => s.KeyboardState.Height,
source: KeyboardBindings.ScaffoldAncestor);
Properties
ScaffoldAncestor
The relative source resolving the nearest ancestor Scaffold — combine it
with the typed SetBinding(property, static (Scaffold s) => s.KeyboardState.…,
source: KeyboardBindings.ScaffoldAncestor) for fully typed, compiled bindings.
public static RelativeBindingSource ScaffoldAncestor { get; }
Property Value
Remarks
The keyboard state is scaffold-level (one soft keyboard per window), so unlike the nav bar context there is nothing per-page to resolve here.
Methods
Create(string, BindingMode, IValueConverter?, object?, string?)
Builds a string-path binding into the ambient ScaffoldKeyboardState.
[DynamicDependency(DynamicallyAccessedMemberTypes.PublicProperties, typeof(Scaffold))]
[DynamicDependency(DynamicallyAccessedMemberTypes.PublicProperties, typeof(ScaffoldKeyboardState))]
public static BindingBase Create(string path = ".", BindingMode mode = BindingMode.Default, IValueConverter? converter = null, object? converterParameter = null, string? stringFormat = null)
Parameters
pathstringThe path within the state ("." binds the state object itself).
modeBindingModeThe binding mode.
converterIValueConverterThe converter.
converterParameterobjectThe converter parameter.
stringFormatstringThe string format.