void initTable(List<nsConf> pre_config) { //config_to_return = pre_config; if (pre_config != null) { //m_nstab.ItemsSource = pre_config; } else { /* List<nsConf> data_source = new List<nsConf>(); data_source.Add(new_conf); m_nstab.ItemsSource = data_source; */ nsConf_inner new_conf = new nsConf_inner() { ns = "Hello", source = "World!" }; DataGridItemsSource.Add(new_conf); m_nstab.ItemsSource = DataGridItemsSource; m_nstab.Items.Refresh(); DataGridItemsSource.Add(new_conf); DataGridTextColumn ns_col = new DataGridTextColumn() { Binding = new Binding("ns") { Mode = BindingMode.TwoWay } }; m_nstab.Columns.Add(ns_col); DataGridTextColumn ns_source_col = new DataGridTextColumn() { Binding = new Binding("source") { Mode = BindingMode.TwoWay } }; m_nstab.Columns.Add(ns_source_col); } }
void initTable(List <nsConf> pre_config) { //config_to_return = pre_config; if (pre_config != null) { //m_nstab.ItemsSource = pre_config; } else { /* List<nsConf> data_source = new List<nsConf>(); * data_source.Add(new_conf); * m_nstab.ItemsSource = data_source; */ nsConf_inner new_conf = new nsConf_inner() { ns = "Hello", source = "World!" }; DataGridItemsSource.Add(new_conf); m_nstab.ItemsSource = DataGridItemsSource; m_nstab.Items.Refresh(); DataGridItemsSource.Add(new_conf); DataGridTextColumn ns_col = new DataGridTextColumn() { Binding = new Binding("ns") { Mode = BindingMode.TwoWay } }; m_nstab.Columns.Add(ns_col); DataGridTextColumn ns_source_col = new DataGridTextColumn() { Binding = new Binding("source") { Mode = BindingMode.TwoWay } }; m_nstab.Columns.Add(ns_source_col); } }