Skip to content

Getting started

Marc Rousavy edited this page Aug 22, 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.


πŸ“¦ You can also use the Jellyfish Visual Studio Extension πŸ“– to create a new MVVM project using Jellyfish! If you do not want to use the extension, follow this quickstart guide to get Jellyfish MVVM ready for your project:


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 Feeds

The IFeed<T> allows notifying any subscribers in this feed about sudden changes within the application domain in realtime.

class CustomViewModel : INode<NotifyReason>
{
    public CustomViewModel
    {
        this.Register();
    }

    public void MessageReceived(NotifyReason reason)
    { ... }
}

Feed.Notify(NotifyReason.RefreshView);

See Feeds πŸ“–