Skip to main content

CreatesCommandBindingViaCommandParameter

Struct CreatesCommandBindingViaCommandParameter 

Source
pub struct CreatesCommandBindingViaCommandParameter<C> { /* private fields */ }
Expand description

Binds a command to a control of type C that has a Command and a CommandParameter property (CreatesCommandBindingViaCommandParameter): the binding assigns the parameter, then the command, and disposing it restores the values the control had.

The affinity is BindingAffinity::EXPLICIT for a control of type C when no event is named, and zero otherwise: this binder binds no event.

Implementations§

Source§

impl<C: 'static> CreatesCommandBindingViaCommandParameter<C>

Source

pub fn new( command: PropertyPath<Rc<C>, Option<Rc<dyn ICommand>>>, set_command: impl Fn(&C, Option<Rc<dyn ICommand>>) + 'static, command_parameter: PropertyPath<Rc<C>, CommandParameter>, set_command_parameter: impl Fn(&C, CommandParameter) + 'static, ) -> Self

A binder over the Command property (command reads it, set_command assigns it) and the CommandParameter property of the controls of type C.

Trait Implementations§

Source§

impl<C> Debug for CreatesCommandBindingViaCommandParameter<C>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<C: 'static> ICreatesCommandBinding for CreatesCommandBindingViaCommandParameter<C>

Source§

fn bind_command_to_object_event( &self, _command: Option<Rc<dyn ICommand>>, _target: Option<Rc<dyn Any>>, _command_parameter: Rc<dyn IObservable<CommandParameter>>, _event_name: &str, ) -> Option<Rc<dyn IDisposable>>

None: this binder binds no event.

Source§

fn bind_command_to_object_with_handlers( &self, _command: Option<Rc<dyn ICommand>>, _target: Option<Rc<dyn Any>>, _command_parameter: Rc<dyn IObservable<CommandParameter>>, _subscription: CommandEventSubscription, ) -> Option<Rc<dyn IDisposable>>

None: this binder binds no event.

Source§

fn get_affinity_for_object( &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§

fn bind_command_to_object( &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.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.