A component can optionally participate in the app config. This allows for the component's behavior and initial state to be easily modified without having to deploy custom code. Different instances of the same component type can reference different app config items, allowing for multiple components in the same application with different behavior.
Check out and setup the Geocortex Mobile SDK Quickstart project.
Copy the following code into your project to setup a basic component without app config.
If you want to learn more about how this component was created, check out the custom component tutorial
- Code Behind
Create a new file
CustomComponentConfiguration.cs. This class defines a new app item type
custom-component-config. This app item type will be used as configuration for the
Components that consume configuration should extend
AppItemComponentBase<ConfigurationClassType>. This forces them to have a constructor which takes in an
IAppItem resolver for the specific configuration type. This resolver can then be called in the
DoInitializeAsync method to retrieve the app config values. They should also register with Autofac using the
AppItemComponent assembly attribute.
- Code Behind
- View Model
At this point, the component is hooked up to configuration, and configuration values can be defined and consumed.
App Config is defined in the app JSON and linked to the component through the
config attribute in layout, just like any other component.
- App Config
- User Interface
Check out the relevant Geocortex Mobile SDK Sample:
Learn more about components in Geocortex Mobile
Component and Service Interactions
Learn how components and services interact in Geocortex Mobile
Implement a Custom Service
Learn how to implement a custom service using the Geocortex Mobile SDK