Skip to content
This repository has been 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

Open
anose001 opened this issue Aug 22, 2024 · 0 comments

Comments

@anose001
Copy link

anose001 commented Aug 22, 2024

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?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant