FerroUI/ docs

Search guides, controls, Rust APIs, and XAML.

    GitHub ↗

    ICreatesCommandBinding

    trait · ferroui-reactiveui · v0.5.0

    trait ICreatesCommandBinding
    

    A plugin that binds an ICommand to a control (ICreatesCommandBinding). The implementations are registered in the service locator (Splat) as dyn ICreatesCommandBinding, and the one with the highest affinity for the type of a control binds it (CommandBinderService), as upstream.

    The crate registers none: CreatesCommandBindingViaEvent and CreatesCommandBindingViaCommandParameter bind the controls of one type, and a platform registers its own (the controls of FerroUI).

    Deviation (DEVIATIONS.md, ReactiveUI): the trait is object safe. The type parameter T of the control is a TypeId in get_affinity_for_object and the control an Rc<dyn Any> in the bindings; TEventArgs has no counterpart (the handler ignores the arguments of the event); the add and remove handlers are one CommandEventSubscription; the command parameter is an observable of CommandParameter.

    View source

    Members

    get_affinity_for_object

    fn get_affinity_for_object(self: &Self, target_type: TypeId, has_event_target: bool) -> i32
    

    A positive number when this plugin can bind a command to an object of the type target_type, the highest number winning among the plugins; zero or less when it cannot (GetAffinityForObject<T>(bool hasEventTarget)). has_event_target says whether the caller names the event to bind to.

    Source

    bind_command_to_object

    fn bind_command_to_object(self: &Self, command: Option<Rc<dyn ICommand>>, target: Option<Rc<dyn Any>>, command_parameter: Rc<dyn IObservable<CommandParameter>>) -> Option<Rc<dyn IDisposable>>
    

    Binds command to target through the default event of the target (Click, ...), executed with the latest value of command_parameter; None when no binding was made, as for a missing command (BindCommandToObject<T>). Disposing the result unbinds the command.

    Source

    bind_command_to_object_event

    fn bind_command_to_object_event(self: &Self, command: Option<Rc<dyn ICommand>>, target: Option<Rc<dyn Any>>, command_parameter: Rc<dyn IObservable<CommandParameter>>, event_name: &str) -> Option<Rc<dyn IDisposable>>
    

    Binds command to the event named event_name of target (BindCommandToObject<T, TEventArgs>(..., string eventName)).

    Source

    bind_command_to_object_with_handlers

    fn bind_command_to_object_with_handlers(self: &Self, command: Option<Rc<dyn ICommand>>, target: Option<Rc<dyn Any>>, command_parameter: Rc<dyn IObservable<CommandParameter>>, subscription: CommandEventSubscription) -> Option<Rc<dyn IDisposable>>
    

    Binds command to the event that subscription adds a handler to (BindCommandToObject<T, TEventArgs>(..., addHandler, removeHandler)).

    Source

    Trait implementations

    Availability

    Extracted for aarch64-apple-darwin. Cargo features are listed in the crate index.