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. (Last updated on: June 24, 2019).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

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

Thread ID:

Created:

Updated:

Platform:

Replies:

151298 Feb 6,2020 07:27 AM UTC Feb 25,2020 12:55 PM UTC WPF 3
loading
Tags: SfChart
Ranjithkumar caliaperoumal
Asked On February 6, 2020 07:27 AM UTC

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

Lavanya Anaimuthu [Syncfusion]
Replied On February 7, 2020 08:57 AM UTC

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.  
  
 
Thanks, 
Lavanya A. 
 


Harsh Shah
Replied On February 24, 2020 05:23 AM UTC

Hii,
I have a solution
XAML code
<Grid Name="LayoutRoot">
<Grid.Resources>

    <Style x:Key="CategoryLegendItem" TargetType="DVC:LegendItem">
        <Setter Property="Template">
            <Setter.Value>
                <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}" />
                    </StackPanel>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>
</Grid.Resources>
<DVC:Chart Name="mcChart"  >
</DVC:Chart>
C# 
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"];
                mcChart.Series.Add(ser);



Hemalatha Marikumar [Syncfusion]
Replied On February 25, 2020 12:55 PM UTC

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. 
 
Regards, 
Hemalatha M. 


CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Please sign in to access our forum

This page will automatically be redirected to the sign-in page in 10 seconds.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

Live Chat Icon For mobile
Live Chat Icon