Hi,
I have a legend like this:
<Style TargetType="esri:Legend">
<Setter Property="LayerItemsMode" Value="Tree" />
<Setter Property="ShowOnlyVisibleLayers" Value="False" />
<Setter Property="LayerIDs" Value="USAID_Layers" />
<!-- Legend.LayerTemplate with checkbox for sublayer visibility-->
<Setter Property="LayerTemplate">
<Setter.Value>
<DataTemplate>
<StackPanel Orientation="Horizontal">
<StackPanel Orientation="Horizontal">
<Grid VerticalAlignment="Center">
<CheckBox IsChecked="{Binding IsEnabled, Mode=TwoWay}" />
<CheckBox IsChecked="{Binding IsEnabled}" IsEnabled="{Binding IsVisible}" IsHitTestVisible="False" />
</Grid>
<TextBlock Text="{Binding Label}" VerticalAlignment="Center" Margin="2,0,0,0" MouseLeftButtonDown="TextBlock_MouseLeftButtonDown" />
</StackPanel>
</StackPanel>
</DataTemplate>
</Setter.Value>
</Setter>
</Style>
private void TextBlock_MouseLeftButtonDown(object sender, MouseButtonEventArgs e)
{
TextBlock textSender = (TextBlock)sender;
string layerName = textSender.Text;
}
Upon cliking on the Textblock, I can get the layer name. I also need the SubLayerID in the same click. How can I grab that?
Thanks a lot,
Miri