思路:大项目的每项中包含一个小项目集合,用ListBox嵌套ListBox或ListBox嵌套ItemsCtrol是个比较好的方式,现总结如下:
第一:先构建题目类,再建一个选项类,题目类集合中的每个项包含一个选项类集合,即数组嵌套数组,C#语句如下:
(为方便看清语句,类直接写在主程序中)
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Windows; using System.Windows.Controls; using System.Windows.Data; using System.Windows.Documents; using System.Windows.Input; using System.Windows.Media; using System.Windows.Media.Imaging; using System.Windows.Navigation; using System.Windows.Shapes; using System.Collections.ObjectModel;//ObservableCollection命名空间 namespace ListBoxInListBox { /// <summary> /// MainWindow.xaml 的交互逻辑 /// </summary> public partial class MainWindow : Window { public MainWindow() { InitializeComponent(); } //题目类 class question { public string qutestionName//题目名,比如:第1题或第2题等 { get; set