Proposal for including the ParameterPath property in the EventToCommandBehavior class to retrieve the CommandParameter value from a property mapped within the EventArgs object #2365
egvijayanand
started this conversation in
New Feature Discussions
Replies: 1 comment 2 replies
-
@jfversluis @pictos Please share your thoughts on this. |
Beta Was this translation helpful? Give feedback.
2 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Proposal for including the ParameterPath property in the EventToCommandBehavior class to retrieve the CommandParameter value from a property mapped within the EventArgs object.
This EventToCommandBehavior is undoubtedly one of the most useful types in the MVVM context as it is the de facto option when there is no support for commands.
Often, the parameter value required for the ViewModel command is encapsulated within the EventArg object.
A converter is necessary to complete the task. However, most converters perform a similar function: they assign (map) the value for the parameter from a property.
Agree that a generic version of the EventToCommandBehavior exists, yet it is not fully functional in scenarios where ViewModels are defined within a library and shared across different AppModels. For example, using .NET MAUI for Mobile Apps and WPF for Desktop Apps, but VM is shared. The EventArgs types are UI-specific.
To address such scenarios, it is proposed to add the ParameterPath property, which is simply the property of interest.
Kindly let me know your thoughts on this.
Change:
Below is the code that I wrote for this (only relevant section is shown):
Usage:
Beta Was this translation helpful? Give feedback.
All reactions