This is a quick introduction for developers who don't have a lot of time to read all the docs. This document contains the absolute basics of what a developer needs to know.
Table of Contents |
---|
Core
Catel properties
All properties in classes deriving from ModelBase (thus also ViewModelBase) require a special property definition.
Normally one would write something like this:
Code Block |
---|
private string _firstName;
public string FirstName
{
get { return _firstName; }
set
{
RaisePropertyChanging("FirstName");
_firstName = value;
RaisePropertyChanged("FirstName");
}
} |
In Catel one should write this:
Code Block |
---|
public string FirstName
{
get { return GetValue< string>(FirstNameProperty); }
set { SetValue(FirstNameProperty, value); }
}
public static readonly PropertyData FirstNameProperty = RegisterProperty("FirstName", typeof(string), null); |
Catel will automatically take care of change notifications.
Info |
---|
Note that you can use the dataprop or vmprop to easily create these properties using code snippets. You can also use Catel.Fody instead |
MVVM