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

namespace ClosePopupOnApplyFilter
{
	public partial class MainPage : UserControl
	{
		public MainPage()
		{
			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());
		//}
	}
}