XBinding
struct · ferroui-markup-xaml · v0.5.0
struct XBinding
The binding of one target property to an {x:Bind} path: the compiled path, read from the
root source of the XBindings it belongs to, in the mode the markup gave it.
Its expression is the ordinary binding expression of the engine over the nodes of the path,
after a root node that publishes the root source only while the bindings are initialized.
OneWay and TwoWay follow change notification (registered properties,
INotifyPropertyChanged); OneTime reads when the bindings are initialized or updated.
The converter, the fallback value and the target null value of the markup are the options of
the expression (WinUI's BindAssignment, GetConverterExpression, FallbackValueExpression,
TargetNullValueExpression): the value of the path goes through Convert (and ConvertBack
when a TwoWay binding writes the target back), a path that cannot be read gives the target
the fallback value, a null value the target null value.
On an event (step X4) the path ends with the method the event calls; the compiler gives the
binding to bind_routed_event or
bind_markup_event instead of binding a property. The handler is
subscribed while the bindings of the root are initialized, and it calls the method on the
value of the path before it, read when the event is raised.
Members
bindingspathmodeupdate_source_triggerphasebind_routed_eventbind_markup_eventtry_create_instance
bindings
fn bindings(self: &Self) -> &Rc<XBindings>
The bindings of the root this binding reads from.
path
fn path(self: &Self) -> Option<CompiledBindingPath>
mode
fn mode(self: &Self) -> BindingMode
update_source_trigger
fn update_source_trigger(self: &Self) -> UpdateSourceTrigger
phase
fn phase(self: &Self) -> i32
The phase in which a container reads the binding (x:Phase of the element of its
target); 0 without one.
bind_routed_event
fn bind_routed_event(self: &Self, target: &Ref<Interactive>, event: &RoutedEvent) -> Result<(), XamlLoadError>
target.Event += handler of a routed event (Click="{x:Bind OnClick}"): the handler is
added with the routes of a handler markup adds (direct and bubble, unhandled events) when
the bindings of the root are initialized, and removed when they stop tracking. The target
is held weakly.
bind_markup_event
fn bind_markup_event(self: &Self, event: &'static MarkupEvent, target: MarkupValue) -> Result<(), XamlLoadError>
target.Event += handler of an event that is not a routed event, which metadata
declares with its subscription (events:): subscribed when the bindings of the root
are initialized; the subscription the event returns is released when they stop tracking
(an event without one keeps the handler, which then does nothing). The target is held
weakly.
try_create_instance
fn try_create_instance(self: &Self, target: &FerroObject, target_property: Option<&'static FerroProperty>) -> Result<Rc<BindingExpression>, XamlLoadError>
The expression of the binding on target_property of target, registered with the
bindings of its root.
Trait implementations
SendSyncFreezeUnsafeUnpinUnpinUnwindSafeRefUnwindSafeBorrow<T>BorrowMut<T>Into<U>From<T>TryInto<U>TryFrom<U>AnyAnyValueClassDefaultsErasedDestructorIntoEitherBindingBasePartialEqMarkupTyped
Availability
Extracted for aarch64-apple-darwin. Cargo features are listed in the crate index.