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 System.Windows.Navigation;
using C1.WPF;

namespace ControlExplorer
{
    public partial class ControlsPage : Page
    {
        public ControlsPage()
        {
            InitializeComponent();

            DataContext = MainViewModel.Instance;
        }

        private void TileControl_Click(object sender, EventArgs e)
        {
            var link = ((sender as FrameworkElement).DataContext as ControlDescription).Link;
            var frame = Application.Current.MainWindow as ControlExplorer.Frame;
            //var frame = VTreeHelper.GetParentOfType(this, typeof()) as ControlExplorer.Frame;
            if (frame != null)
            {
                frame.Navigate(link, frame.NavigationFrame.CurrentSource);
            }
            else
            {
                NavigationService.Navigate(link);
            }
        }

    }
}
