This blog will discuss defining custom Project and Application level settings using the Pro SDK. Project and Application settings can be accessed off the ArcGIS Pro Options property page dialog.
Custom project settings are saved in the project and can be accessed each time the project is reopened. This is accomplished by the Module class’ overrides OnReadSettingsAsync and OnWriteSettingsAsync methods. A Property Sheet should be added to the Options dialog in ArcGIS Pro to provide a UI for users to view and modify these settings.
Add an ArcGIS Pro Property sheet item using the Pro SDK to your add-in project. Add any UI elements you need such as check boxes, radio buttons etc that define specific project settings.
Insert your custom property sheet into the Options dialog by adding it to the property sheet collection of the "esri_core_optionsPropertySheet" (as shown below) in your Config.daml. Set the "group" attribute on your "insertPage" DAML element to "Project".
<!--Use group=Project for the options to appear under the Project section in the settings-->
<!--assign the viewModel class to the className attribute; assign the view class to the
className attribute in the content tag-->
<insertPage id="esri_sdk_PropertyPageProjectSettings" caption="Sample Project Settings"
<content className="ProjectSettingsView" />
The ViewModel of your property sheet should be updated whenever the module OnReadSettingsAsync override gets called. Conversely, the property sheet ViewModel should be queried for its current settings whenever the module OnWriteSettingsAsync override gets called (which is on every project save). The settings themselves are persisted as strings in the project and so must be seriailizable.
ArcGIS Pro Application level custom settings can be added to the existing Pro application settings via a .NET application settings file. Settings are modified via a Properties.Settings class that you define with your own custom properties and values. Settings are persisted to a user.config file in the logged-on user’s AppData folder and will be read at add-in initialization when the Settings class instance (in your add-in) is instantiated. Settings are saved when you explicitly call “save” on your Settings class instance (e.g. in response to a user changing settings on your custom application property sheet).
To expose custom application settings in the UI, add another property sheet to the "esri_core_optionsPropertySheet" collection (as before for Project settings). This time set its "group" attribute to “Application”.
<!--Use group=Application for the options to appear under the Application section in the settings-->
<!--assign the viewModel class to the className attribute; assign the view class to the className attribute in the content tag-->
<insertPage id="esri_sdk_PropertyPageAppSettings" caption="Sample App Settings" className="ApplicationSettingsViewModel" group="Application">
<content className="ApplicationSettingsView" />
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.