private void SplitDataGird_KeyDown(object sender, KeyEventArgs e) { if (e.Key == Key.Delete) { SplitTuple row = (SplitTuple)SplitDataGird.SelectedItem; ObservableCollection <SplitTuple> data = (ObservableCollection <SplitTuple>)SplitDataGird.ItemsSource; data.Remove(row); } }
void InitSectData() { IBSection ps1; ps1 = new IBSection { ID = 1, Name = "标准主梁", H1 = 700, H2 = 600, H3 = 1800, T1 = 32, T2 = 24, T3 = 18 }; SectionList.Add(ps1); ps1 = new IBSection { ID = 2, Name = "边跨主梁", H1 = 700, H2 = 600, H3 = 1800, T1 = 50, T2 = 32, T3 = 18 }; SectionList.Add(ps1); ps1 = new IBSection { ID = 3, Name = "边跨主梁", H1 = 700, H2 = 600, H3 = 1800, T1 = 50, T2 = 32, T3 = 18 }; SectionList.Add(ps1); ps1 = new IBSection { ID = 4, Name = "边支座主梁", H1 = 700, H2 = 600, H3 = 1800, T1 = 62, T2 = 36, T3 = 18 }; SectionList.Add(ps1); ps1 = new IBSection { ID = 5, Name = "小纵梁", H1 = 300, H2 = 300, H3 = 300, T1 = 15, T2 = 15, T3 = 10 }; SectionList.Add(ps1); ps1 = new IBSection { ID = 6, Name = "普通横梁", H1 = 300, H2 = 300, H3 = 700, T1 = 24, T2 = 24, T3 = 13 }; SectionList.Add(ps1); ps1 = new IBSection { ID = 7, Name = "跨中横梁", H1 = 400, H2 = 400, H3 = 1100, T1 = 24, T2 = 24, T3 = 14 }; SectionList.Add(ps1); ps1 = new IBSection { ID = 8, Name = "中支座横梁", H1 = 400, H2 = 400, H3 = 1100, T1 = 24, T2 = 24, T3 = 16 }; SectionList.Add(ps1); ps1 = new IBSection { ID = 9, Name = "边支座横梁", H1 = 400, H2 = 1060, H3 = 1500, T1 = 24, T2 = 28, T3 = 16 }; SectionList.Add(ps1); ps1 = new IBSection { ID = 10, Name = "中纵梁", H1 = 300, H2 = 500, H3 = 300, T1 = 16, T2 = 20, T3 = 10 }; SectionList.Add(ps1); SectionDataGird.ItemsSource = SectionList; SplitTuple st1; st1 = new SplitTuple { SectID = 1, Length = 8 }; SplitList.Add(st1); st1 = new SplitTuple { SectID = 2, Length = 20 }; SplitList.Add(st1); st1 = new SplitTuple { SectID = 1, Length = 8 }; SplitList.Add(st1); st1 = new SplitTuple { SectID = 4, Length = 8 }; SplitList.Add(st1); st1 = new SplitTuple { SectID = 1, Length = 33 }; SplitList.Add(st1); st1 = new SplitTuple { SectID = 3, Length = 6 }; SplitList.Add(st1); st1 = new SplitTuple { SectID = 1, Length = 33 }; SplitList.Add(st1); st1 = new SplitTuple { SectID = 4, Length = 8 }; SplitList.Add(st1); st1 = new SplitTuple { SectID = 1, Length = 8 }; SplitList.Add(st1); st1 = new SplitTuple { SectID = 2, Length = 20 }; SplitList.Add(st1); st1 = new SplitTuple { SectID = 1, Length = 8 }; SplitList.Add(st1); SplitDataGird.ItemsSource = SplitList; }