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

namespace RadGridView_SL4_AR_6
{
    public partial class MainPage : UserControl
    {
        public MainPage()
        {
            InitializeComponent();
            clubsGrid.ItemsSource = Club.GetClubs();
            clubsGrid.RowDetailsVisibilityChanged += new EventHandler<GridViewRowDetailsEventArgs>(clubsGrid_RowDetailsVisibilityChanged);
        }

        void clubsGrid_RowDetailsVisibilityChanged(object sender, GridViewRowDetailsEventArgs e)
        {
            (((e.DetailsElement as RadTabControl).Items[0] as RadTabItem).Content as RadGridView).ItemsSource = (e.Row.Item as Club).Players;

            (((e.DetailsElement as RadTabControl).Items[1] as RadTabItem).Content as ContentControl).Content = new Image() { Source = new BitmapImage((e.Row.Item as Club).Emblem) };
        }
    }
}
