我有5套清单,我将不得不管理5套不同的校对清单。 我也想在需要一个“综合”清单才能具有约束力的数据网中显示这些清单的进展情况。
不能确定从哪里开始。 如果我使用目录,如果我删除该分项,则将不更新括号。
public partial class MainWindow : Window
{
ObservableCollection<TestObject> _combinedList = new ObservableCollection<TestObject>();
public ObservableCollection<TestObject> CombinedList
{
get
{
return _combinedList;
}
set
{
_combinedList = value;
}
}
List<TestObject> _list1 = new List<TestObject>();
List<TestObject> _list2 = new List<TestObject>();
List<TestObject> _list3 = new List<TestObject>();
List<TestObject> _list4 = new List<TestObject>();
List<TestObject> _list5 = new List<TestObject>();
public MainWindow()
{
InitializeComponent();
dataGridCombined.ItemsSource = CombinedList;
}
private void cmdCreateLists_Click(object sender, RoutedEventArgs e)
{
createLists();
}
public void createLists()
{
for (int i = 1; i < 6; i++)
{
_list1.Add(new TestObject(i));
}
for (int i = 1; i < 6; i++)
{
_list2.Add(new TestObject(i*3));
}
for (int i = 1; i < 6; i++)
{
_list3.Add(new TestObject(i*5));
}
for (int i = 1; i < 6; i++)
{
_list4.Add(new TestObject(i*7));
}
for (int i = 1; i < 6; i++)
{
_list5.Add(new TestObject(i*9));
}
}
private void cmdMergeLists_Click(object sender, RoutedEventArgs e)
{
//Doesn t work and if i remove item from sublist, CombinedList doesn t update.
CombinedList = _list1.Concat<TestObject>(_list2);
}
}
public class TestObject : BindableObject
{
private int _number;
public int Number
{
get
{
return _number;
}
set
{
_number = value;
RaisePropertyChanged("Number");
}
}
private string _name;
public string Name
{
get
{
return _name;
}
set
{
_name = value;
RaisePropertyChanged("Name");
}
}
public TestObject(int inNum)
{
_number = inNum;
_name = "John";
}
}
我不得不在这里撰写某种习俗汇编?
关于