private void OnDataGridSelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            var viewModel = MainGrid.DataContext as SeuratExtensionWindowViewModel;

            if (e.AddedItems.Count > 0)
            {
                _study = e.AddedItems[0] as StudyInfo;

                // Display the options pane with automatic height

                TaskOptions.Visibility = Visibility.Visible;
                //TaskOptions.Height = double.NaN;
                //TaskOptions.Margin = new Thickness(10);

                if (_study != null && viewModel != null)
                {
                    _hof      = viewModel.GetHallOfFame(_study);
                    _complete = viewModel.GetHallOfFame(_study); // Get it twice to avoid cloning
                    //_complete = viewModel.GetComplete(_study, _complete);
                    viewModel.InitProperties(_hof.solutions.Length, _complete.solutions.Length, viewModel.UseComplete);

                    //DisplayOrHideControls(true, true);
                }
            }
        }
        public SeuratExtensionWindow()
        {
            InitializeComponent();

            // Hide the options pane until something is selected

            //TaskOptions.Visibility = Visibility.Hidden;
            //TaskOptions.Height = 0;
            _study = null;
            _hof   = null;
        }
 private void OnDataGridMouseLeftButtonDown(object sender, MouseButtonEventArgs e)
 {
     if (sender != null)
     {
         _study = null;
         //TaskOptions.Visibility = Visibility.Hidden;
         //TaskOptions.Height = 0;
         //TaskOptions.Margin = new Thickness(0);
         var grid = sender as DataGrid;
         if (grid != null && grid.SelectedItems != null && grid.SelectedItems.Count == 1)
         {
             var dgr = grid.ItemContainerGenerator.ContainerFromItem(grid.SelectedItem) as DataGridRow;
             if (dgr.IsMouseOver)
             {
                 (dgr as DataGridRow).IsSelected = false;
             }
         }
     }
 }