Skip to content

Getting started

Marc Rousavy edited this page Jun 28, 2018 · 9 revisions

Jellyfish Wiki

Jellyfish aims at being a very simplistic yet powerful MVVM backbone.

This guide should get you started with Jellyfish in little to no time.

1. Install

Jellyfish is on NuGet:

PM> Install-Package Jellyfish

2. Follow the MVVM pattern

For each View (Window, Control, ..), create the corresponding Model, View and ViewModel:

Model
class UserListModel : Model
{ ... }
View
<Window ...>
    <ListView ItemsSource="{Binding Users}" />
</Window>
ViewModel
class UserListViewModel : ViewModel
{
    private ObservableCollection<User> _users;
    public ObservableCollection<User> Users
    {
        get => _users;
        set => Set(ref _users, value);
    }
}

See Models πŸ“– and View Models πŸ“–

3. Additional Observable Objects

Every object with properties that need to be observed for changes needs to implement the ObservableObject class:

class User : ObservableObject
{ ... }

See Observable Objects πŸ“–

4. Commands

The RelayCommand is an ICommand implementation.

ICommand LoginCommand = new RelayCommand(LoginAction);
// ...
void LoginAction(object parameter)
{ ... }

See Commands πŸ“–

5. Message Channels

The MessageChannel allows sending objects within the current application domain.

var channel = MessageChannel<string>.Channel;
channel.Notify("Hello other ViewModels!");

See Message Channels πŸ“–

Clone this wiki locally