private void On_BTN_Add_Click(object sender, RoutedEventArgs e) { GaoVM vm = new GaoVM(); vm.Name = TXT_Name.Text; vm.Text = TXT_Text.Text; GaoData.Data.AddData(vm); _colle.Add(vm); TXT_Text.Clear(); LB_Gaos.ScrollIntoView(vm); }
private void On_BTN_Insert_Click(object sender, RoutedEventArgs e) { if (LB_Gaos.SelectedIndex != -1) { int idx = LB_Gaos.SelectedIndex + 1; GaoVM vm = new GaoVM(); vm.Name = TXT_Name.Text; vm.Text = TXT_Text.Text; GaoData.Data.Insert(idx, vm); _colle.Insert(idx, vm); TXT_Text.Clear(); LB_Gaos.ScrollIntoView(vm); } }