hi,I'm dealing with a few different types of layers (WMSlayer and dynamicservicelayer) that are composed of several sublayers. I've bound them to a treeview, so that each layer service is a parent node with child nodes for the sublayers. I'd like to implement controls that toggle the visibility of the sublayers. I've looked at the sublayer API sample online as a guide, and it works great - provided you only have 1 service, as the service name is hardcoded in the example. I'm having a difficult time trying to reference the parent service layer from within my nested datatemplate. The hierarchicaldatetemplate needs to be nested (at least I think it does) because the same property (Name) is not valid for both parent and child layers of a service. The sticking point is the childTemplate CheckBox Name...I'd like to be able to reference/bind the name of the parent service, but I can't figure out how...either in codebehind or in XAML binding.
<sdk:HierarchicalDataTemplate x:Key="childTemplate" ItemsSource="{Binding Layers}">
<StackPanel Orientation="Horizontal">
<!--Layer visibility checkbox-->
<CheckBox Name="CurrentEvents" IsChecked="{Binding DefaultVisibility, Mode=TwoWay}"
VerticalAlignment="Center" Tag="{Binding ID}" ClickMode="Press" Click="CheckBox_Click" />
<!--Layer name-->
<TextBlock Text="{Binding Name, Mode=OneWay}" Width="75" Foreground="AntiqueWhite" Margin="5,0,0,0"
VerticalAlignment="Center" >
</TextBlock>
</StackPanel>
</sdk:HierarchicalDataTemplate>
<sdk:HierarchicalDataTemplate x:Key="categoryTemplate1" ItemsSource="{Binding Layers}" ItemTemplate="{StaticResource childTemplate}" >
<StackPanel Orientation="Horizontal">
<CheckBox IsChecked="{Binding Visible, Mode=TwoWay}" VerticalAlignment="Center" />
<!--Opacity slider-->
<Slider Margin="-5,0,0,0" Minimum="0" Maximum="1" Width="30"
Value="{Binding Opacity, Mode=TwoWay}" Height="18" />
<TextBlock Text="{Binding ID}" />
</StackPanel>
</sdk:HierarchicalDataTemplate>