Tag Archives: mvvm

Application built on Twitch stream using WPF and C# to copy data to clipboard

I found the “Programming” “game” on Twitch and decided to give it a try, but I needed something interesting and meaningful to develop. So I had this idea of a software to create that can greatly help me on daily basis.

It is an application that allows you to create commands to copy data to clipboard. You can copy plain text, text from files, images from files, files itself.

It uses WPF with MVVM. This is CopyPasterino…
Continue reading

Advertisements

Closing a window in MVVM pattern

The MVVM pattern says that the UI logic should be withing the View. Your ViewModel should not know about the view.

But, imagine the following scenario: you have two buttons on your screen, one to save changes and close and another to cancel and close. But how do you close the window if your view model does not know what is the window and does not know how to handle UI logic?
Continue reading

The MVVM pattern in WPF

In WPF we have the Model-View-ViewModel (MVVM) pattern. This pattern was created to allow you to separate concerns in a way that your business logic is going to be decoupled from your interface.

What happens in this pattern is that your View is going to be purely an user interface. Your ViewModel is going to contain the interface logic, it will be connected to your View through bindings and communicate through notifications. And your Model (for example a database model class) will be able to exchange data directly with your ViewModel.

From MSDN:

mvvm
Continue reading

Messaging – EventAggregator

In WPF MVVM we might want to send a message from one View Model to another. For example if we want to close a window and return data to the opener window. To allow such data exchange we can use a messaging system.
For that we have the EventAggregator pattern.
The EventAggregator class is going to store all instances that are being tracked. So when a message is published all those listed instances are going to be notified.

Continue reading