List related features

View inWPFUWPFormsiOSAndroid
View on GitHub

List features related to the selected feature.

Image of list related features

Use case

Related features are useful for managing relational information, like what you would store in a relational database management system (RDBMS). You can define relationship between records as one-to-one, one-to-many, or many-to-one. For example, you could model inspections and facilities as a many-to-one relationship. Then, for any facility feature, you could list related inspection features.

How to use the sample

Click on a feature to select it. The related features will be displayed in a list.

How it works

  1. With a Feature, call QueryRelatedFeaturesAsync on the feature's feature table.
  2. Iterate over the result's collection of RelatedFeatureQueryResult objects to get the related features and add them to a list.

Relevant API

  • ArcGISFeature
  • ArcGISFeatureTable
  • FeatureQueryResult
  • FeatureTable.QueryRelatedFeatures
  • RelatedFeatureQueryResult

Tags

features, identify, query, related, relationship, search

Sample Code

ListRelatedFeatures.xamlListRelatedFeatures.xaml.cs
                              
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
<UserControl
    x:Class="ArcGISRuntime.UWP.Samples.ListRelatedFeatures.ListRelatedFeatures"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:esriUI="using:Esri.ArcGISRuntime.UI.Controls">
    <Grid>
        <esriUI:MapView x:Name="MyMapView" />
        <Border Style="{StaticResource BorderStyle}">
            <StackPanel>
                <TextBlock Text="Tap a park (green) to see related features."
                           TextAlignment="Center" FontWeight="SemiBold"
                           Margin="0,0,0,10" />
                <ProgressBar x:Name="LoadingProgress"
                             IsIndeterminate="True"
                             Height="15"
                             Margin="0,0,0,10" Visibility="Visible" />
                <ListView x:Name="MyResultsView"
                          MaxHeight="300"
                          ScrollViewer.HorizontalScrollBarVisibility="Disabled"
                          SelectionMode="None">
                    <ListView.ItemTemplate>
                        <DataTemplate>
                            <TextBlock Text="{Binding}" TextWrapping="Wrap" />
                        </DataTemplate>
                    </ListView.ItemTemplate>
                </ListView>
            </StackPanel>
        </Border>
    </Grid>
</UserControl>

Your browser is no longer supported. Please upgrade your browser for the best experience. See our browser deprecation post for more details.