WPF and MVVM Standard, doubts

Asked

Viewed 54 times

2

I’m studying C# and I’m having to develop a WPF application with the MVVM standard. One 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 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 viewmodel. So I don’t access the elements directly, this would be a good solution?

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

And then in the view:
inserir a descrição da imagem aqui

What about the events, should I really avoid? I am in a situation where I need to allow the click 2x on a view element, its properties to change...

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.