ContextData
ContextData is a dictionary to store data in the viewModel.
Warning
ContextData is different from Fields. Fields are used to store data that is displayed in the UI, while ContextData is used to store data that is not displayed in the UI.
Usage
You should use ContextData to store data that is not displayed in the UI. For example to store a reference to a SystemEnvironment.Window.
- You can store a reference an opened window in the
ContextData.
ContextData["OpenPage"] = SystemEnvironment.Window.OpenUrl("https://documentation.neos.groupeisagri.com/", null, "width=768,height=768");
- Then you can access the opened window in the viewModel
var openPage = (SystemEnvironment.Window)ContextData["OpenPage"];
openPage.Close();