private void listBox2_SelectionChanged(object sender, SelectionChangedEventArgs e) { DataViewDes obj = listBox2.SelectedItem as DataViewDes; if (obj != null) { if (obj.IsRemoteGetData) { DataGrid1.ItemsSource = obj.DataFeildList; lblCount1.Content = obj.DataFeildList.Count; } else { List <DataFeild> list = new BLL_DataFeild().GetList(obj.DataViewId); obj.DataFeildList = list; obj.IsRemoteGetData = true; DataGrid1.ItemsSource = list; lblCount1.Content = list.Count; } } else { DataGrid1.ItemsSource = null; lblCount1.Content = "0"; } }
public List <DataViewDes> Tras(DataTable dt) { List <DataViewDes> list = new List <DataViewDes>(); foreach (DataRow row in dt.Rows) { DataViewDes obj = new DataViewDes { ChineseName = row["ChineseName"].ToString(), DataViewId = row["DataViewId"].ToString(), DataViewName = row["DataViewName"].ToString(), Type = row["Type"].ToString(), }; list.Add(obj); } return(list); }