我在加载表单后使用xml文件加载wpf数据网格。
private void Filter_Loaded(object sender, RoutedEventArgs e)
{
DataSet dd = new DataSet();
dd.ReadXml(@"E:/WPF12/Main27-02-15/IntelligraphicsSniffer24-2-15/Intelligraphics Sniffer/Resources/XMLFile2.xml");
AddFilterDataGrid.AutoGenerateColumns = true;
AddFilterDataGrid.ItemsSource = dd.Tables[0].DefaultView;
// AddFilterDataGrid.Columns[0].Visibility = Visibility.Hidden;
}
这里我想在datagrid中隐藏一个coloumn(即filter1 coloumn)。我怎样才能做到这一点? 这里我给的是xml文件样本
<NewDataSet>
<Filter>
<name>one</name>
<filter0>12</filter0>
<filter1>15</filter1>
</Filter>
<Filter>
<name>sathish </name>
<filter0>999</filter0>
<filter1>robo</filter1>
</Filter>
</NewDataSet>
&#13;
有人可以帮助我吗?
答案 0 :(得分:0)
您可以像这样隐藏列:
AddFilterDataGrid.Columns[0].Visibility = Visibility.Collapsed;