Jacob
Jacob

Reputation: 3698

MVVM Where should be the TriggerAction class

I develop WPF MVVM application that uses class which inherits from TriggerAction<UIElement> base class.

public class DropTrigger : TriggerAction<UIElement> {...}

This class handle drop files event and should pass the list of files to the ViewModel bounded class.

In this case, should the DropTrigger class be in View or ViewModel? If it should be in the view (like I think), how can I execute methods in the MVVM bounded class from DropTrigger class?

Thank you !

Upvotes: 0

Views: 111

Answers (1)

Mike Fuchs
Mike Fuchs

Reputation: 12319

I cannot give you a definitive answer without seeing more of your code. The most likely case is you would have an ICommand dependency property on your DropTrigger that you bind to a ViewModel property, then you pass the files in the CommandParameter.

The Trigger is, like the behavior, neither View nor ViewModel. Create a separate project folder containing these classes.

Upvotes: 1

Related Questions