0

我有一个带按钮的菜单,每个按钮都有一个类别。在菜单旁边,我放置了一个列表框。此列表框链接到数据库中的产品列表。我希望每当我按下类别按钮时,链接到该类别(带有 categoryID)的产品将显示在列表框中。

我使用以下代码在列表框中显示产品

var productslist = from products in db.products select products;
prodlb.ItemsSource = productslist;
4

1 回答 1

0
private void Buttonproducts_OnClick(object sender, RoutedEventArgs e)
    {
        var productslist = from products in db.products select products;
        prodlb.ItemsSource = productslist;
    }

private void ButtonCustomers_OnClick(object sender, RoutedEventArgs e)
    {
        var Customerslist = from Customers in db.customers select customers;
        prodlb.ItemsSource = Customerslist;
    }
于 2018-01-08T10:00:37.430 回答