-
-
Notifications
You must be signed in to change notification settings - Fork 144
Quick Start
Antony Male edited this page Mar 19, 2014
·
21 revisions
Want to get up and running as quickly as possible? This is the right place!
First off, delete MainWindow.xaml and MainWindow.xaml.cs. You won't be needing them.
Next, you'll need a root View and a ViewModel. The View has to be a Window, but there are no other restrictions.
<Window x:Class="Stylet.Samples.Hello.RootView"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Height="300" Width="300">
<TextBlock>Hello, World</TextBlock>
</Window>
The ViewModel can be any old class (for now - you might want it to be a Screen or Conductor, discussed elsewhere).
class RootViewModel
{
}
Next, you'll need a bootstrapper. For now, you don't need anything special - just something to identify your root ViewModel.
class Bootstrapper : Bootstrapper<RootViewModel>
{
}
Finally, this needs to be referenced as a resource in your App.xaml. Add the following. You'll also need to remove the StartupUri
attribute, like this:
<Application x:Class="Stylet.Samples.Hello.App"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="clr-namespace:Stylet.Samples.Hello">
<Application.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary>
<local:Bootstrapper x:Key="bootstrapper"/>
</ResourceDictionary>
</ResourceDictionary.MergedDictionaries>
</ResourceDictionary>
</Application.Resources>
</Application>
That's it! Run that, and you should get a window with 'Hello World' in it.
- 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