Pull Component Data from App Config
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.
#
PrerequisitesCheck out and setup the Geocortex Mobile SDK Quickstart project.
#
Setup a Basic ComponentCopy the following code into your project to setup a basic component without app config.
tip
If you want to learn more about how this component was created, check out the custom component tutorial
- Layout
- Component
- View
- Code Behind
#
Create a Skeleton App Config DefinitionCreate 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 CustomComponent
.
#
Consume the Configuration in the ComponentComponents 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.
- Component
- View
- Code Behind
- View Model
#
Define Configuration ValuesAt 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.
- Layout
- App Config
- User Interface

#
Relevant SDK SampleCheck out the relevant Geocortex Mobile SDK Sample:
#
Next StepsComponent Reference
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