In the new version of the TableOfContents it no longer uses the common LiyerList. This approach the basemap behaved similar to the OperationalLayer and both would have a check box. With the new design there is a TocItem.Content which differs for Basemap layers.
This uses the BasemapItemTemplate and I see where this could be adjusted. Adding a check box isn't an issue but the issue is how would I tie the checkbox to the actual BaseLayer (we can assume there is only one). I tried this:
<SPAN class="token tag"><SPAN class="token tag"><SPAN class="punctuation token"><</SPAN>DataTemplate</SPAN><SPAN class="punctuation token">></SPAN></SPAN>
<SPAN class="token tag"><SPAN class="token tag"><SPAN class="punctuation token"><</SPAN>Grid</SPAN> <SPAN class="attr-name token">Margin</SPAN><SPAN class="attr-value token"><SPAN class="punctuation token">=</SPAN><SPAN class="punctuation token">"</SPAN>0,2<SPAN class="punctuation token">"</SPAN></SPAN><SPAN class="punctuation token">></SPAN></SPAN>
<Grid.ColumnDefinitions>
<SPAN class="token tag"><SPAN class="token tag"><SPAN class="punctuation token"><</SPAN>ColumnDefinition</SPAN> <SPAN class="attr-name token">Width</SPAN><SPAN class="attr-value token"><SPAN class="punctuation token">=</SPAN><SPAN class="punctuation token">"</SPAN>Auto<SPAN class="punctuation token">"</SPAN></SPAN> <SPAN class="punctuation token">/></SPAN></SPAN>
<SPAN class="token tag"><SPAN class="token tag"><SPAN class="punctuation token"><</SPAN>ColumnDefinition</SPAN> <SPAN class="attr-name token">Width</SPAN><SPAN class="attr-value token"><SPAN class="punctuation token">=</SPAN><SPAN class="punctuation token">"</SPAN>*<SPAN class="punctuation token">"</SPAN></SPAN> <SPAN class="punctuation token">/></SPAN></SPAN>
</Grid.ColumnDefinitions>
<SPAN class="token tag"><SPAN class="token tag"><SPAN class="punctuation token"><</SPAN>CheckBox</SPAN> <SPAN class="attr-name token">IsChecked</SPAN><SPAN class="attr-value token"><SPAN class="punctuation token">=</SPAN><SPAN class="punctuation token">"</SPAN>{Binding Content.BaseLayers[0].IsVisible, Mode<SPAN class="punctuation token">=</SPAN>TwoWay}<SPAN class="punctuation token">"</SPAN></SPAN><SPAN class="punctuation token">></SPAN></SPAN>
<SPAN class="comment token"><!--<CheckBox.Style>
<Style TargetType="CheckBox">
<Style.Triggers>
<DataTrigger Binding="{Binding Content.CanChangeVisibility, Mode=OneTime}" Value="False">
<Setter Property="Visibility" Value="Collapsed" />
</DataTrigger>
</Style.Triggers>
</Style>
</CheckBox.Style>--></SPAN>
<SPAN class="token tag"><SPAN class="token tag"><SPAN class="punctuation token"></</SPAN>CheckBox</SPAN><SPAN class="punctuation token">></SPAN></SPAN>
<SPAN class="token tag"><SPAN class="token tag"><SPAN class="punctuation token"><</SPAN>TextBlock</SPAN> <SPAN class="attr-name token">Text</SPAN><SPAN class="attr-value token"><SPAN class="punctuation token">=</SPAN><SPAN class="punctuation token">"</SPAN>{Binding Content.Name, Mode<SPAN class="punctuation token">=</SPAN>OneWay}<SPAN class="punctuation token">"</SPAN></SPAN> <SPAN class="attr-name token">Grid.Column</SPAN><SPAN class="attr-value token"><SPAN class="punctuation token">=</SPAN><SPAN class="punctuation token">"</SPAN>1<SPAN class="punctuation token">"</SPAN></SPAN> <SPAN class="attr-name token">VerticalAlignment</SPAN><SPAN class="attr-value token"><SPAN class="punctuation token">=</SPAN><SPAN class="punctuation token">"</SPAN>Center<SPAN class="punctuation token">"</SPAN></SPAN> <SPAN class="punctuation token">/></SPAN></SPAN>
<SPAN class="token tag"><SPAN class="token tag"><SPAN class="punctuation token"></</SPAN>Grid</SPAN><SPAN class="punctuation token">></SPAN></SPAN>
<SPAN class="token tag"><SPAN class="token tag"><SPAN class="punctuation token"></</SPAN>DataTemplate</SPAN><SPAN class="punctuation token">></SPAN></SPAN><SPAN class="line-numbers-rows"><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN></SPAN>I have tried to find something showing how to bind to a specific item in the ItemsSource without any luck
Thoughts?
Morten Nielsen