-
-
Notifications
You must be signed in to change notification settings - Fork 144
Home
Stylet is a minimal, but powerful, MVVM framework inspired by Caliburn.Micro. Its intention is to cut down on the complexity and magic even further, to allow people (coworkers) unfamiliar with any MVVM framework to get up to speed more quickly.
A brief feature list is shown below:
The classic MVVM structure, where a view knows how to instantiate its ViewModel, and ViewModels typically don't communicate directly, is known as View-first. However, reversing this pattern - instantiating the ViewModels yourself and having the Views automatically attached - provides many advantages, allowing you to compose your ViewModels in a way which should feel very familiar. This ViewModel-first approach is the only one supported by Stylet.
The ICommand interface which WPF uses is powerful but a bit clunky and unintuitive. It doesn't seem right that actions to be taken by your ViewModel in response to things like button clicks should be represented as properties, rather than methods. A simple <Button Command="{s:Action DoSomething}"/>
will cause DoSomething()
on your ViewModel to be called every time the button is clicked. Additionally, if you have a bool property called CanDoSomething
, that will be observed and used to tell whether the button should be enabled or disabled.
Actions also work with events, allowing you to do things like <Button MouseEnter="{s:Action DoSomethingElse}"/>
.
Stylet's Event Aggregator is very similar to Caliburn.Micro's, and allows subscribers to receive messages from publishes without either having knowledge of, or retaining, the other. This is particularly useful for messaging between ViewModels, although it has plenty of other uses.
With a ViewModel-first approach, you display windows and dialogs by referencing the ViewModel to display, and the View gets attached automatically. The WindowManager allows this to be done with ease.
- Introduction
- Quick Start
- Bootstrapper
- ViewModel First
- Actions
- The WindowManager
- MessageBox
- The EventAggregator
- PropertyChangedBase
- Execute: Dispatching to the UI Thread
- Screens and Conductors
- BindableCollection
- Validation using ValidatingModelBase
- StyletIoC
- The ViewManager
- Listening to INotifyPropertyChanged
- Design Mode Support
- Logging
- Misc