using System.Windows;
using Telerik.Windows.Controls;
using Telerik.Windows.Data;
using Telerik.Windows.Controls.GridView;
using System;

namespace RadGridView_WPF_AR_7
{
    /// <summary>
    /// Interaction logic for MainWindow.xaml
    /// </summary>
    public partial class MainWindow : Window
    {
        private FromDateToDateFilterControl customFilter;

        public MainWindow()
        {
            InitializeComponent();

            customFilter = ((FromDateToDateFilterControl)((GridViewDataColumn)this.clubsGrid.Columns["Established"]).FilteringControl);

            customFilter.FromDate = new DateTime(1863, 1, 1);

            customFilter.ToDate = new DateTime(1933, 1, 1);

            this.clubsGrid.ItemsSource = Club.GetClubs();

        }

        private void ButtonClearFilter_Click(object sender, RoutedEventArgs e)
        {
            clubsGrid.FilterDescriptors.Clear();

            customFilter.IsActive = false;

            //
            // If you do not have an instance of the FromDateToDateFilterControl, you could do this:
            //
            //foreach (GridViewDataColumn column in clubsGrid.Columns)
            //{
            //    if (column.FilteringControl != null)
            //    {
            //        column.FilteringControl.IsActive = false;
            //    }
            //}
        }
    }
}
