using C1.Xaml;
using C1.Xaml.FlexGrid;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using Windows.UI.Xaml;
using Windows.UI.Xaml.Controls;
using Windows.UI.Xaml.Controls.Primitives;


namespace ControlExplorer.Controls.FlexGrid
{
    public partial class FlexGridFilter : UserControl
    {
        public List<ColumnFilter> CurrentFilters { get; set; }

        public FlexGridFilter(List<ColumnFilter> filters)
        {
            InitializeComponent();
            CurrentFilters = filters;
            _flexGridColumns.ItemsSource = CurrentFilters;
        }
    }

    public class ColumnFilter : INotifyPropertyChanged
    {
        private Column _column;
        public Column Column
        {
            get
            {
                return _column;
            }
            set
            {
                if (_column != value)
                {
                    _column = value;
                    OnPropertyChanged("Column");
                }
            }
        }

        private String _value;
        public String Value
        {
            get
            {
                return _value;
            }
            set
            {
                if (_value != value)
                {
                    _value = value;
                    OnPropertyChanged("Value");
                }
            }
        }

        public event PropertyChangedEventHandler PropertyChanged;

        private void OnPropertyChanged(string propertyName)
        {
            if (PropertyChanged != null)
            {
                PropertyChanged(this, new PropertyChangedEventArgs(propertyName));
            }
        }
    }
}
