I am trying to recreate the example called "Line Graph legend" under Miscellanous in the following link, http://research.microsoft.com/en-us/um/cambridge/projects/ddd/d3isdk/
I am using WPF not silverligth, and was having problems getting the references for the following XAML portion.
<d3:Chart.LegendContent>
<d3:LegendItemsPanel>
<d3:LegendItemsPanel.Resources>
<DataTemplate x:Key="Microsoft.Research.DynamicDataDisplay.LineGraph">
<StackPanel Orientation="Horizontal">
<CheckBox IsChecked="{Binding Path=Visibility, Converter={StaticResource VisibilityToCheckedConverter}, Mode=TwoWay}"/>
<Line Width="15" Height="15" X1="0" Y1="0" X2="15" Y2="15" Stroke="{Binding Path=Stroke}" StrokeThickness="2"/>
<TextBlock Margin="5,0,0,0" Text="{Binding Path=Description}"/>
</StackPanel>
</DataTemplate>
</d3:LegendItemsPanel.Resources>
</d3:LegendItemsPanel>
</d3:Chart.LegendContent>
Thanks
I suffered the same confusion when starting with D3. From what I understand, it was first developed for WPF, then used as a springboard for building the same functionality in Silverlight. So the examples you see online have some differences and some additional capabilities that you won't see in the WPF version.
For one, the class "Chart" does not exist in the WPF version. You'll more likely be using "ChartPlotter" for your graphs. Same with "Legend" and "LineLegendItem" instead of "LegendContent" and "LegendItemsPanel". This might be where you're trying to go:
<d3:ChartPlotter>
<d3:Legend>
<d3:LineLegendItem>
<d3:LineLegendItem.Resources>
<DataTemplate StackPanel with checkbox>
</d3:LineLegendItem.Resources>
</d3:LineLegendItem>
</d3:Legend>
</d3:ChartPlotter>
I haven't used these classes personally, so I have no first-hand knowledge that this matches the Silverlight example, but I hope it's enough to get you off the ground and experimenting.
I highly recommend looking at the examples from the download on the official D3 page. I found out recently that you can view the code behind their samples, which is annoyingly not included in the download, online here. (Stable>v0.3.1>src>Samples, find the sample you'd like to examine).
I don't see any there that have your exact example of having a checkbox in the legend, but your method seems like it should work once you start accessing the right classes.
Also, I assume you're using the following line, and not the Silverlight one, to reference the library:
xmlns:d3="http://research.microsoft.com/DynamicDataDisplay/1.0"