FeatureDataGrid
This sample demonstrates the use of the FeatureDataGrid control. This control provides an interactive data table for GraphicsLayers. Aside from providing a tabular display of the layer's data, graphics can be selected, deselected, and zoomed to by interacting with the FeatureDataGrid. The key elements in the sample's XAML are the SimpleFillSymbol and FeatureDataGrid. The FeatureDataGrid uses a symbol's selected state for displaying selection. The sample XAML declares a color animation for the symbol's selected state. The FeatureDataGrid declaration binds the FeatureDataGrid to the Map control and sets its GraphicsLayer property to the second layer in the map. The code-behind declares an event handler that scrolls to a record in the FeatureDataGrid when the corresponding Graphic is clicked in the map.
Download Sample Application<UserControl x:Class="ArcGISWPFSDK.LocalFeatureDataGrid" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:basics="http://schemas.microsoft.com/wpf/2008/toolkit" xmlns:esri="http://schemas.esri.com/arcgis/client/2009"> <Grid Background="White"> <Grid.Resources> <BooleanToVisibilityConverter x:Key="BooleanToVisibilityConverter"/> <esri:SimpleRenderer x:Key="SelectRenderer"> <esri:SimpleRenderer.Symbol> <esri:SimpleFillSymbol> <esri:SimpleFillSymbol.ControlTemplate> <ControlTemplate> <Path x:Name="Element" Fill="#330000FF" Stroke="Black" StrokeThickness="1" Cursor="Hand"> <VisualStateManager.VisualStateGroups> <VisualStateGroup x:Name="SelectionStates"> <VisualState x:Name="Unselected" /> <VisualState x:Name="Selected"> <Storyboard> <ColorAnimation Storyboard.TargetName="Element" Storyboard.TargetProperty="(Path.Fill).(SolidColorBrush.Color)" To="#99FFFF00" Duration="0:0:.25" /> <ColorAnimation Storyboard.TargetName="Element" Storyboard.TargetProperty="(Path.Stroke).(SolidColorBrush.Color)" To="#9900FFFF" Duration="0:0:.25" /> <DoubleAnimation Storyboard.TargetName="Element" Storyboard.TargetProperty="StrokeThickness" To="3" Duration="00:00:.25" /> </Storyboard> </VisualState> </VisualStateGroup> </VisualStateManager.VisualStateGroups> </Path> </ControlTemplate> </esri:SimpleFillSymbol.ControlTemplate> </esri:SimpleFillSymbol> </esri:SimpleRenderer.Symbol> </esri:SimpleRenderer> </Grid.Resources> <Grid.RowDefinitions> <RowDefinition Height="*" /> <RowDefinition Height="5" /> <RowDefinition Height="150" /> </Grid.RowDefinitions> <esri:Map x:Name="MyMap" WrapAround="True" Extent="-15000000,2000000,-7000000,8000000" Background="#FFE3E3E3" MinimumResolution="2445.98490512499"> <esri:ArcGISLocalTiledLayer ID="myBaseMap" Path="..\\Data\\TPKs\\Topographic.tpk"/> <esri:ArcGISLocalFeatureLayer ID="States" LayerName="States" Path="..\\Data\\MPKS\\USCitiesStatesEdit.mpk" Renderer="{StaticResource SelectRenderer}" OutFields="*" Editable="True" MouseLeftButtonDown="FeatureLayer_MouseLeftButtonDown" /> </esri:Map> <GridSplitter Grid.Row="1" HorizontalAlignment="Stretch" /> <esri:FeatureDataGrid Grid.Row="2" x:Name="MyDataGrid" Map="{Binding ElementName=MyMap}" GraphicsLayer="{Binding ElementName=MyMap, Path=Layers.[1]}" Foreground="Black" Initialized="MyDataGrid_Initialized"/> <ProgressBar x:Name="MyProgressBar" IsIndeterminate="True" VerticalAlignment="Bottom" Width="200" Height="20" Margin="10" Visibility="{Binding Path=IsBusy, Converter={StaticResource BooleanToVisibilityConverter}}"></ProgressBar> </Grid> </UserControl>