private static readonly DependencyProperty AssociatedLayerIDProperty = DependencyProperty.RegisterAttached("AssociatedLayerID", typeof(string), typeof(Graphic), null);
FeatureLayer featureLayer = sender as FeatureLayer; foreach (Graphic graphic in featureLayer) { graphic.SetValue(AssociatedLayerIDProperty, featureLayer.ID); }
string associatedField = (sender as FrameworkElement).GetValue(AssociatedLayerIDProperty) as string;
<esri:LineSymbol x:Key="DefaultLineSymbol"> <esri:LineSymbol.ControlTemplate> <ControlTemplate> <Grid> <Path x:Name="Element" Stroke="{Binding Symbol.Color}" StrokeThickness="{Binding Symbol.Width}" Tag="{Binding Path=(my:MyClass.LayerId)}"/> </Path> </Grid> </ControlTemplate> </esri:LineSymbol.ControlTemplate> </esri:LineSymbol>
{Binding Layers[1].ID, ElementName=MyMap}
<esri:LineSymbol x:Key="DefaultLineSymbol" x:Shared="False"> <esri:LineSymbol.ControlTemplate> <ControlTemplate> <Grid> <Path x:Name="Element" Stroke="{Binding Symbol.Color}" StrokeThickness="{Binding Symbol.Width}"/> <Path x:Name="TouchArea" Stroke="Transparent" StrokeThickness="10" Data="{Binding Data, ElementName=Element}" > <i:Interaction.Triggers> <gti:TouchTrigger HandleTouches="True" > <gti:PathMapTipAction Attributes="{Binding Attributes}" LayerId={Binding Path=(my:MyClass.LayerId)} /> </gti:TouchTrigger> </i:Interaction.Triggers> </Path> </Grid> </esri:LineSymbol.ControlTemplate> </esri:LineSymbol>
Signed in members can post, follow updates, and more. New here? Register a free account.
Find useful guides, FAQs, and documents to help you navigate and make the most of Esri Community.