I have 6 lineseries, it can show/hide by user selection. The legend should be show/hide with it's series. so in the LegendTemplate:
<DataTemplate x:Key="LegendTemplate">
<Border BorderThickness="0.5" CornerRadius="5" Visibility="{Binding Series.Visibility}" >
<StackPanel Orientation="Horizontal">
<Rectangle Fill="{Binding ActualItemBrush}" Width="20" Height="10" Margin="2" />
<TextBlock Text="{Binding Series.Title}" Margin="0,0,5,0" />
But the legend still shows up even the lines are not showing.
Hi Joan,
I'm not sure why the binding isn't working for you. I'd need to be able to see your application in order to debug it.
I've attached my sample where it's working. The sample has a button that when clicked sets the series Visibility property to collapsed. This hides the series and also causes the legend item to update and hide itself properly. Take a look at the sample and see if there are any differences you can find in implementation that might cause your issue.
Let me know if you have any questions on this.