We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

Is there any event for checkbox visibility changed in legenditem and we can subscribe to it.

Is there any event for checkbox visibility changed in legenditem and we can subscribe to it.

3 Replies

LA Lavanya Anaimuthu Syncfusion Team February 7, 2020 03:57 AM

Hi Ranjithkumar caliaperoumal,  
Greetings from Syncfusion.  
You can achieve this requirement using the MouseDown event in ChartLegend. For more details you can refer the following KB to achieve this,  

However, another way is to bind a property to IsSeriesVisible property of a series to get the notification. 
You can enable legend item only for the primary series and then bind the same boolean property (the property which holds the state of series visibility) from view model to all the associated series IsSeriesVisible property. By this way, when the primary series is clicked, all the associated series visibility will also be toggled.  
Please let us know if need any further assistance on this.  
Lavanya A. 

HS Harsh Shah February 24, 2020 12:23 AM

I have a solution
XAML code
<Grid Name="LayoutRoot">

    <Style x:Key="CategoryLegendItem" TargetType="DVC:LegendItem">
        <Setter Property="Template">
                <ControlTemplate TargetType="DVC:LegendItem">
                    <StackPanel Orientation="Horizontal">
                        <CheckBox VerticalAlignment="Center" IsChecked="{Binding RelativeSource={RelativeSource Mode=TemplatedParent}, Path=Owner.Visibility, Mode=TwoWay, Converter={StaticResource BooleanToVisibilityConverter1}}" Margin="0,0,3,0" />
                        <Rectangle Width="8" Height="8" Fill="{Binding Background}" Stroke="{Binding BorderBrush}" StrokeThickness="1" Margin="0,0,3,0" />
                        <DV:Title VerticalAlignment="Center" Content="{TemplateBinding Content}" />
<DVC:Chart Name="mcChart"  >
ColumnSeries ser = new ColumnSeries { Title = kvpNuclide.Value, IndependentValueBinding = new Binding("Key"), DependentValueBinding = new Binding("Value") };
                ser.ItemsSource = null;
                ser.ItemsSource = listRelease;
                ser.DataPointStyle = columnStyleAqua;
                ser.LegendItemStyle = (Style)LayoutRoot.Resources["CategoryLegendItem"];

HM Hemalatha Marikumar Syncfusion Team February 25, 2020 07:55 AM

Hi Harsh Shah, 
Thanks for your update. 
But here, we have a follow-up based on the Syncfusion SfChart control. But your updated code is not related to our control. 
Hemalatha M. 

Live Chat Icon For mobile
Up arrow icon