My WPFToolKit table contains several series. I myself masked the legend and also launched the LegendItem template, creating a style resource:
<Style x:Key="CustomLegendItemStyle" TargetType="{x:Type charting:LegendItem}"> <Setter Property="IsTabStop" Value="False" /> <Setter Property="Template"> <Setter.Value> <ControlTemplate TargetType="{x:Type charting:LegendItem}"> <Border Background="{TemplateBinding Background}" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}"> <DockPanel LastChildFill="True"> <Ellipse Width="10" Height="10" Fill="{Binding Background}" Stroke="{Binding Background}" StrokeThickness="1" Margin="0,0,3,0" DockPanel.Dock="Left"/> <CheckBox IsChecked="{Binding Path=Visibility,Converter={StaticResource VisToBoolConverter},Mode=TwoWay}" /> <TextBlock DockPanel.Dock="Right" Text="(num)" /> <datavis:Title Content="{TemplateBinding Content}" Margin="10 0" /> </DockPanel> </Border> </ControlTemplate> </Setter.Value> </Setter> </Style> <Style TargetType="{x:Type charting:LineSeries}"> <Setter Property="LegendItemStyle" Value="{StaticResource CustomLegendItemStyle}" /> </Style>
This creates a checkbox in LegendItem that should control the visibility of the series. But this is not so. I also created properties in the ViewModel (which by default is true / visible) and with which the LineSeries binding is bound to
<charting:LineSeries ... Visibility="{Binding DisplayLoad,Converter={StaticResource BoolToVisConverter},Mode=TwoWay}" />
But these two are not connected. If I changed the flag binding path to StoopidUser, I get a binding error in the output window informing me that the StoopidUser property was not found on the LineDataPoint object, which puzzles me a bit. I checked directly and do not see (a) why it is LineDataPoint (b) how to get to the series from it.
Do you see what is wrong?
Andyc source share