Exemplo n.º 1
0
 private void MainPage_Loaded(object sender, RoutedEventArgs e)
 {
     using (libDB_Context db = new libDB_Context())
     {
         list1.ItemsSource = db.things.ToList();
     }
 }
Exemplo n.º 2
0
        public void InitalizeDocs()
        {
            TreeViewItem treeViewItem;

            TreeView_ClassesAndParralells.Items.Add(treeViewItem = new TreeViewItem()
            {
                Header = "Классы и Парралелли"
            });
            using (libDB_Context db = new libDB_Context())
            {
                //TreeViewItem item;
                //treeViewItem.ItemsSource = db.parrallels.ToList();
                //TreeViewItem trees = (TreeViewItem)treeViewItem.Items[1];
                var iss = db.parrallels;

                //iss

                foreach (var item in db.parrallels)
                {
                    TreeViewItem d;
                    treeViewItem.Items.Add(d = new TreeViewItem()
                    {
                        Header = item.ToString()
                    });
                    d.ItemsSource = db.classes.Where(p => p.parrallel == item.id).ToList();
                    //trees.Items.Add
                    //var item_s = (TreeViewItem)item;
                    //var parrallels = db.parrallels;
                    //item_s.ItemsSource = //db.parrallels.
                }

                /*foreach (var item in db.classes.Select(p=> new { })
                 * {
                 *
                 * }*/
                //db.parrallels.Classes

                /*foreach (var parallels in db.parrallels)
                 * {
                 * treeViewItem.ItemsSource
                 * }*/
                //treeViewItem.Items.Add()
            }
        }