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

namespace ClosePopupOnApplyFilter
{
	/// <summary>
	/// Interaction logic for Window1.xaml
	/// </summary>
	public partial class Window1 : Window
	{
		public Window1()
		{
			InitializeComponent();
			
			this.clubsGrid.ItemsSource = Club.GetClubs();

			// Uncomment this if you have your columns defined in XAML and 
			// want to make all of them follow this behavior.
			
			//foreach (var column in this.clubsGrid.Columns)
			//{
			//    GridViewBoundColumnBase c = column as GridViewBoundColumnBase;
			//    if (c != null)
			//    {
			//        Interaction.GetBehaviors(column).Add(new ClosePopupOnApplyFilterBehavior());
			//    }
			//}

			
			// If your columns are auto-generated you can attach to the AutoGeneratingColumn event
			// of RadGridView and set the behavior. You can even create another behavior for
			// RadGridView itself (Behavior<RadGridView>) that does all of these and turn it on
			// from XAML. 
			// 
			// The possibilities that behaviors provide are simply endless!
			
			//this.clubsGrid.AutoGeneratingColumn += this.OnAutoGeneratingColumn;
		}

		//void OnAutoGeneratingColumn(object sender, GridViewAutoGeneratingColumnEventArgs e)
		//{
		//    Interaction.GetBehaviors(e.Column).Add(new ClosePopupOnApplyFilterBehavior());
		//}
	}
}
