-
-
Notifications
You must be signed in to change notification settings - Fork 4
Getting started
mrousavy edited this page Aug 21, 2018
·
9 revisions
Jellyfish aims at being a very simplistic yet powerful MVVM backbone.
This guide should get you started with Jellyfish in little to no time.
Jellyfish is on NuGet:
PM> Install-Package Jellyfish
For each View (Window, Control, ..), create the corresponding Model, View and ViewModel:
class UserListModel : Model
{ ... }
<Window ...>
<ListView ItemsSource="{Binding Users}" />
</Window>
class UserListViewModel : ViewModel
{
private ObservableCollection<User> _users;
public ObservableCollection<User> Users
{
get => _users;
set => Set(ref _users, value);
}
}
See Models π and View Models π
Every object with properties that need to be observed for changes needs to implement the ObservableObject
class:
class User : ObservableObject
{ ... }
The RelayCommand
is an ICommand
implementation.
ICommand LoginCommand = new RelayCommand(LoginAction);
// ...
void LoginAction(object parameter)
{ ... }
See Commands π
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 π