Click or drag to resize
Model
C#
internal sealed class Settings : global::System.Configuration.ApplicationSettingsBase
{
    public static Settings Default { get { ... } }

    public string ProviderHostName { get { ... } set { ... } }

    public string ProviderPort { get { ... } set { ... } }

    public string ListeningPort { get { ... } set { ... } }

    public string LogFolder { get { ... } set { ... } }

    public bool AutoScrollToMostRecentEvent { get { ... } set { ... } }
}

The Model is not particularly interesting, because its only purpose is to handle settings persistence. Note that this is not a particularly typical or even exemplary Model, see the note at the bottom of the introduction for this tutorial.

Change Notification

Often the ViewModel duplicates at least some information provided by the Model, which is why the ViewModel needs to be notified when the data in the Model changes. ApplicationSettingsBase already implements INotifyPropertyChanged, so the code generated by the application settings designer works just fine for us. A more typical Model would simply derive from NotifyPropertyChanged and implement very similar change notification as a ViewModel.