Hello, I found this nice article about adding a custom project/application settings page using the SDK:
<!-- Project --> </modules> <propertySheets> <updateSheet refID="esri_core_optionsPropertySheet"> <insertPage id="esri_sdk_PropertyPageProjectSettings" caption="Sample Project Settings" className="ProjectSettingsViewModel" group="Project"> <content className="ProjectSettingsView" /> </insertPage> </updateSheet> </propertySheets> </ArcGIS> <!-- Application --> </modules> <propertySheets> <updateSheet refID="esri_core_optionsPropertySheet"> <insertPage id="esri_sdk_PropertyPageAppSettings" caption="Sample App Settings" className="ApplicationSettingsViewModel" group="Application"> <content className="ApplicationSettingsView" /> </insertPage> </updateSheet> </propertySheets> </ArcGIS>
Theoretically, it should only be necessary to identify the group-id for the property window of layouts.
Practically, however, there is only one application and one project (at runtime) and several layouts. Which is probably a problem.
So, it is possible?
Thanks in advance!
I made some progess:
<propertySheets> <updateSheet refID="esri_layouts_propertySheet"> <insertPage id="esri_sdk_PropertyPageLayoutSettings" caption="Sample Layout Settings" className="LayoutSettingsViewModel"> <content className="ProjectSettingsView" /> </insertPage> </updateSheet> </propertySheets>
I will keep this thread updated, perhaps someone else will find it useful.
I attached my sample
To implement the sample i added a property sheet (via New Project Item template) and then used you updateSheet daml above to show the property sheet (that i created) under the layout properties dialog . I didn't delete the auto-inserted propertysheet daml yet (for illustration).
in the config.daml of the sample please check the desktopVersion="2.9...." attribute for the AddInInfo tag. Make sure to set it to the version of ArcGIS Pro that you are running: i.e. 2.7.0, 2.6.0 .... Otherwise the sample won't work for you.
Thanks for that, I was at a similarly state 😁!
So I wasn't wrong with my code.
My current problem is to identify the layout-instance inside the wpf-control.
But I think I got it (with your example):
The "PropertyPage1ViewModel" will be instantiated by Pro, Data will be set to the layout-instance.
Then the custom-control "PropertyPage1View" (User-Control) ist created. After the constructor (not at it's end!) the DataContext-Property will be set to the the instance of the view-model.
The next step is to find out, how I should write and read the settings with the module "OnReadSettingsAsync/OnWriteSettingsAsync" (best practice).
contextually, assuming it is the active layout u are after, you can retrieve that from LayoutView.Active. The active layout view provides access to the layout it is rendering via layoutView.Layout.
Note also, in MVVM, your code should really be in the view model (not the view). Thus, u typically dont need access to the view model in the view (via its data context). In your case, the view model is identified by the className attribute on the "insertPage" tag.
Some (hopefully) useful references:
ArcGIS Pro SDK for .NET: Advanced Pro Customization with Focus on Categories and Custom Settings