void tables_SelectedItemChanged(object sender, RoutedPropertyChangedEventArgs <object> e) { this.dgTable.ItemsSource = null; XtnDBTables table = sender as XtnDBTables; TreeViewItem obj = table.SelectedItem as TreeViewItem; if (null == obj) { return; } _CurrentDataTable = obj.Tag as List <MetaDataColumnInfo>; this.dgTable.ItemsSource = _CurrentDataTable; if (null == _fields || 0 == _fields.Length) { return; } foreach (var field in _fields) { var _fi = field.Split(ConstantCollection.Separator_Wavy_line); var column_name = _fi[1].ToLower(); var data = _CurrentDataTable.Where(p => p.column_name.ToLower().Equals(column_name)).GetFirst <MetaDataColumnInfo>(); if (null == data) { continue; } data.IsChoose = true; } }
void tables_SelectedItemChanged(object sender, RoutedPropertyChangedEventArgs <object> e) { XtnDBTables table = sender as XtnDBTables; TreeViewItem obj = table.SelectedItem as TreeViewItem; var fields = obj.Tag as List <MetaDataColumnInfo>; this.lboxFields.Items.Clear(); this.lboxFields.Tag = fields; foreach (var field in fields) { ListBoxItem data = new ListBoxItem(); data.Content = string.Format("{0}【{1}】", field.column_name, field.column_comment); data.Tag = field; this.lboxFields.Items.Add(data); } }