using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;

namespace ChartSamples
{
  [System.ComponentModel.Description("Legend with check boxes that control series visibility")]
  public partial class LegendCheckBox : UserControl
  {
    public LegendCheckBox()
    {
      InitializeComponent();
    }
  }

  public class VisibilityConverter : IValueConverter
  {
    public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
    {
      if (value is Visibility)
      {
        var vis = (Visibility)value;
        return (vis == Visibility.Visible);
      }

      return value;
    }

    public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
    {
      if (value is bool)
      {
        var bval = (bool)value;
        return bval ? Visibility.Visible : Visibility.Collapsed;
      }
      return value;
    }
  }
}
