private void Button_Click_5(object sender, RoutedEventArgs e)
        {
            DoubleAnimation animation = new DoubleAnimation();

            animation.To       = gridHeight;
            animation.From     = 0;
            animation.Duration = new Duration(TimeSpan.FromMilliseconds(100));
            GridMain.BeginAnimation(HeightProperty, animation);

            animation.From     = gridHeight;
            animation.To       = 0;
            animation.Duration = new Duration(TimeSpan.FromMilliseconds(100));
            GridMain1.BeginAnimation(HeightProperty, animation);

            tabSubject.IsEnabled = true;
            ShowGrade.IsEnabled  = true;
        }
        private void btnChapter_Click(object sender, RoutedEventArgs e)
        {
            DataContext = this;
            var    a = ((Button)sender).Tag;
            string b = a.ToString();

            Subjectcode = (tabSubject.SelectedIndex + 1).ToString();
            if (gradecode == null)
            {
                gradecode = "1";
            }
            var c = Grade.GetGrade().Where(x => x.Id.Equals(gradecode)).SelectMany(x => x.subjects).Where(x => x.Id.Equals(Subjectcode)).SelectMany(x => x.units).SelectMany(x => x.ListItems).Where(x => x.Id == b).ToList();

            ani.Clear();


            foreach (var item in c)
            {
                ani.Add(item);
            }



            //foreach (var item in c)
            //{


            //    Items.Add(new Units(item.Title) { Title = item.Title, ListItems = item.ListItems });
            //}

            DoubleAnimation animation = new DoubleAnimation();

            animation.From     = gridHeight;
            animation.To       = 0;
            animation.Duration = new Duration(TimeSpan.FromMilliseconds(100));
            GridMain.BeginAnimation(HeightProperty, animation);

            animation.To       = gridHeight;
            animation.From     = 0;
            animation.Duration = new Duration(TimeSpan.FromMilliseconds(100));
            GridMain1.BeginAnimation(HeightProperty, animation);

            tabSubject.IsEnabled = false;
            ShowGrade.IsEnabled  = false;


            //if (expand == false)
            //{
            //    anim1 = new DoubleAnimation(100, TimeSpan.FromSeconds(0.2));
            //    anim2 = new DoubleAnimation(340, TimeSpan.FromSeconds(0.2));
            //    anim3 = new DoubleAnimation(0, 90, TimeSpan.FromSeconds(0.2));

            //    expand = true;
            //}
            //else
            //{
            //    anim1 = new DoubleAnimation(0, TimeSpan.FromSeconds(0.2));
            //    anim2 = new DoubleAnimation(240, TimeSpan.FromSeconds(0.2));
            //    anim3 = new DoubleAnimation(90, 0, TimeSpan.FromSeconds(0.2));
            //    expand = false;
            //}
            //this.BeginAnimation(Canvas.HeightProperty, anim2);
            //GridMain.BeginAnimation(Canvas.HeightProperty, anim1);
            //     GridMain.Height = 0;



            //Storyboard storyboard = new Storyboard();

            //ObjectAnimationUsingKeyFrames oAnimation = new ObjectAnimationUsingKeyFrames();
            //oAnimation.BeginTime = TimeSpan.Zero;
            //Storyboard.SetTargetName(oAnimation, "GridMain");
            //Storyboard.SetTargetProperty(oAnimation, new PropertyPath("(Height)"));

            //DiscreteObjectKeyFrame doKeyFrame = new DiscreteObjectKeyFrame();
            //doKeyFrame.KeyTime = KeyTime.FromTimeSpan(TimeSpan.Zero);
            //doKeyFrame.Value = GridLength.Auto;
            //oAnimation.KeyFrames.Add(doKeyFrame);
            //storyboard.Children.Add(oAnimation);
        }