你好我試圖隱藏從默認視圖一個DataGrid列,但它給我0列。0列在DataGrid中,當我使用默認視圖
代碼:
productsTableAdapter pta = new productsTableAdapter();
pta.Fill(dataset.products);
productsDataTable pdta = pta.GetDataByInvoiceID(invoiceID);
InvoiceProductsDataGrid.ItemsSource = pdta.DefaultView;
InvoiceProductsDataGrid.Columns[0].Visibility = Visibility.Hidden;
InvoiceProductsDataGrid.Columns[4].Visibility = Visibility.Hidden;
InvoiceProductsDataGrid.Columns[5].Visibility = Visibility.Hidden;
InvoiceProductsDataGrid.Columns[6].Visibility = Visibility.Hidden;
InvoiceProductsDataGrid.Columns[7].Visibility = Visibility.Hidden;
InvoiceProductsDataGrid.Columns[8].Visibility = Visibility.Hidden;
InvoiceProductsDataGrid.Columns[10].Visibility = Visibility.Hidden;
InvoiceProductsDataGrid.Columns[11].Visibility = Visibility.Hidden;
InvoiceProductsDataGrid.Columns[12].Visibility = Visibility.Hidden;
InvoiceProductsDataGrid.Columns[13].Visibility = Visibility.Hidden;
確定PDTA將返回一個或多個行? – trapspring
是的,它給的我的數據 – Dokman