-
-
Notifications
You must be signed in to change notification settings - Fork 4
Getting started
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:
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 π