Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
780
binding LegendTemplate Visibility to Series.Visibility not working
posted

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.

 

Parents
No Data
Reply
  • 34510
    Offline posted

    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.

    xamDataChart-multiLineSeries (2).zip
Children