Custom ILists, CheckBoxDataGrid, Merged Arrays

Earlier I published how to do a CheckBoxDataGrid where the selection model uses CheckBoxes instead of mouse clicks. I should have mentioned that the example used the DataGrid’s selection logic which meant that the dataprovider item’s selected state was not stored in the dataProvider and thus you couldn’t sort by whether an item was selected or not.
If you have a selected field in your data, then the code to handle checkbox selection is quite different. You basically shut down the DataGrid’s selection code and update the collection instead. You can see that in the source code for this example.
This example goes one step further, however. It assumes that you want to store selection in the dataProvider, but the dataProvider items don’t have a selected field and are “immutable”. The example code shows how to use a custom IList to merge two arrays or ArrayCollections into one merged collection where the data objects contain fields from both arrays. By doing that you can “add” a selected field to each item.
Custom ILists are a powerful way to change data without having to process each data item. The example code merges the items on-demand instead of up-front thus saving startup time. It would be wasteful to process 1000 items if you only show 7 and the user doesn’t scroll past 20.
Anyway, here’s the code. Usual caveats apply.
Download Source
Run Demo