Skip to content
This repository was archived by the owner on Nov 1, 2024. It is now read-only.
This repository was archived by the owner on Nov 1, 2024. It is now read-only.

Cannot pass CommandParameter and EventArguments into a Command for the InvokeCommandAction class #175

@anose001

Description

@anose001

Currently it is not possible to pass EventArguments and CommandParameter into the InvokeCommandAction class.

For example, I would like to implement PointerWheelChanged event to command pass a CommandParameter and EventArguments via the below snippet.

      <Interaction.Behaviors>
        <EventTriggerBehavior EventName="PointerWheelChanged"
                              SourceObject="{Binding #BorderControl}">
          <InvokeCommandAction Command="{Binding ZoomCommand}"
                               PassEventArgsToCommand="True"
                               InputConverter="{StaticResource TupleConverter2}"
                               InputConverterParameter="{Binding ElementName=MyCustomControl}">
            <InvokeCommandAction.CommandParameter>
              <MultiBinding>
                <Binding ElementName="MyCustomControl"/>
              </MultiBinding>
            </InvokeCommandAction.CommandParameter>
          </InvokeCommandAction>
        </EventTriggerBehavior>
      </Interaction.Behaviors>

So when the PointerWheelChanged is fired I would like to pass its EventArgs via PassEventArgsToCommand="True" (this currently works). However, passing additional CommandParameters on top of that does not work. According to the InvokeCommandAction.cs

https://github.com/AvaloniaUI/Avalonia.Xaml.Behaviors/blob/d62d2aa68e3943b26b8f33cc120f2e8cc707e038/src/Avalonia.Xaml.Interactions/Core/InvokeCommandAction.cs#L122C5-L159C21

the EventArgs are only passed to the command if no CommandParameter is set. However, I would like to pass it on top of that. Is it possible to implement this or send a PullRequest?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions