Example #1
0
        public ProductsPage(MainWindow _mainWindow, SchoolStuffDB _schoolStuffDB)
        {
            InitializeComponent();

            mainWindow = _mainWindow;
            db         = _schoolStuffDB;

            Item.DataContext = db.Products.ToList();

            //foreach(Product p in db.Products)
            //{
            //    StackPanel item = new StackPanel
            //    {
            //        Style = (Style)Resources["Item"]
            //    };

            //    string path = @"C:\Users\007\source\repos\ForeignSchoolStuff\ForeignSchoolStuff\Images\" + p.MainImagePath.Replace(" ", "");

            //    Image i = new Image
            //    {
            //        Source = new BitmapImage(new Uri(path))
            //    };

            //    TextBlock title = new TextBlock
            //    {
            //        Text = p.Title,
            //        Style = (Style)Resources["Title"]
            //    };

            //    item.Children.Add(i);
            //    item.Children.Add(title);

            //    ItemsPanel.Children.Add(item);
            //}
        }
        public MainWindow()
        {
            InitializeComponent();
            db = new SchoolStuffDB();

            OpenPages(Pages.ProductsPage);
        }