You can store any serialiable content in your user settings. So just define your user selection class, and your Page layout class, and you can make it persistent like any string or integer.
(you can see how here : Custom enum as application setting type in C#? )
Edit : In this post, you can see that you might use any object in your preferences, including one that you defined yourself in your project. To do that, you have to provide the full class name, including the NameSpace of your project (MyNameSpace.MyPreferenceStorageClass) .
Edit 2 : So i will describe more with little example.
1) you have to define a class that will store your settings. I choose arbitrary names for my example :
Public Class UserChoices
Public Property DisplayInColor As Boolean = False
Public Property UseKeyboard As Boolean = True
End Class
Be sure to put a default value.
You need to do a successfull compile after writing your class for the class to be inside current namespace.
2) then go into the Settings Window of your project. Add a settings variable with the Name you want.
I called it AppUserChoices. Then choose the type, go to 'Browse', then type MyNameSpace.UserChoices as a type.
(Obviously, replace 'MyNameSpace' by your namespace... ;-) )
3) you're done. I've written a little code to play with the settings (i put it in the Startup event handler of my Application ):
Launch it several times. The first time, it should report that user choices are nothing. Then they will be ok, and the color setting will switch each time beetween color and B&W.
Private Sub Application_Startup
(ByVal sender As System.Object, ByVal e As System.Windows.StartupEventArgs)
If My.Settings.AppUserChoices Is Nothing Then
MessageBox.Show("AppUserChoices is nothing")
My.Settings.AppUserChoices = New UserChoices
My.Settings.Save()
Else
MessageBox.Show("AppUserChoices is **not** nothing")
My.Settings.AppUserChoices.DisplayInColor = Not My.Settings.AppUserChoices.DisplayInColor
My.Settings.Save()
If My.Settings.AppUserChoices.DisplayInColor Then _
MessageBox.Show("show colors") _
Else _
MessageBox.Show("show in B&W")
End If
End Sub
4) Note that you might want to have the UserChoices class to implement INotifyPropertyChange, in case you modify them in the code. ( Example : if user changes 'DisplayInColor', you might want to set 'PrintInColor' to the same value. )
5) for the preference the user has for page layout, create also a class to store the Layout preferences and a new item in the Settings in the same way.
6) for binding to a settings value, well, let another StackOverflow post do the job :
Bind to a value defined in the Settings