WPF and the MVVM standard, doubts

2

I'm studying C # and am having to develop a WPF application with the default MVVM. A question I have about this pattern is in relation to events, I have read in some places that it is not recommended to use events and also that we can not access components directly, through the viewmodel.

But there are situations that we really need to access elements of the view, for this I created an interface containing the methods I need, implement it in the view and connect it to the viewmodel. So I did not access the elements directly, would this be a good solution?

// interface
public interface IWindowServices
{
    void ToggleWindow();
    void MinimizeWindow();
    void ExitWindow();
}

And then on the view:

What about the events, should I really avoid? I'm in a situation where I need to allow when clicking 2x on an element of the view, its properties change ...

    
asked by anonymous 19.06.2018 / 18:05

0 answers