Widget with Feature Actions

Operations Dashboard for ArcGIS with the Widget with feature actions sample

This Operations Dashboard for ArcGIS sample demonstrates how to use built-in and custom feature actions on a custom widget. The feature actions are configurable in the widget's configuration dialog by implementing the FeatureActionList. The configured feature actions are serialized when the operation view is saved. The FeatureActionContextMenu is used to show the configured feature actions in a context menu when right-clicking on a feature in the list of features the widget is showing.

Operations Dashboard for ArcGIS samples are supported only in Visual Studio 2012. A live preview is not available.

To run this sample, open the solution in Visual Studio 2012, set the Start Action and Start Options debug options in the Project Properties as described in the Testing add-ins help topic, and then build and run the project.

Download Sample Application
XAML C# VB.NET
<UserControl x:Class="WidgetWithFeatureActions.WidgetWithFeatureActions"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
             xmlns:opsDash="clr-namespace:ESRI.ArcGIS.OperationsDashboard;assembly=ESRI.ArcGIS.OperationsDashboard"
             xmlns:opsDashCtl="clr-namespace:ESRI.ArcGIS.OperationsDashboard.Controls;assembly=ESRI.ArcGIS.OperationsDashboard"
             mc:Ignorable="d"
             d:DesignHeight="300"
             d:DesignWidth="300">
  <Grid Margin="10">
    <ListBox x:Name="FeatureListBox"
             Background="Transparent"
             Style="{StaticResource ThemedListBoxStyle}">
      <ListBox.ItemTemplate>
        <DataTemplate>
          <ContentControl Tag="{Binding DataContext, ElementName=FeatureListBox}">
            <TextBlock Text="{Binding FieldValue}"
                       Style="{DynamicResource LargeTextBlockStyle}" />
            <ContentControl.ContextMenu>
              <opsDashCtl:FeatureActionContextMenu FeatureActions="{Binding PlacementTarget.Tag.FeatureActions, RelativeSource={RelativeSource Self}, Mode=OneWay}"
                                                   DataSource="{Binding PlacementTarget.Tag.DataSource, RelativeSource={RelativeSource Self}, Mode=OneWay}"
                                                   Feature="{Binding Graphic, Mode=OneWay}" />
            </ContentControl.ContextMenu>
          </ContentControl>
        </DataTemplate>
      </ListBox.ItemTemplate>
    </ListBox>
  </Grid>
</UserControl>
Sample code usage restrictions
5/16/2014