For the built-in collection editor to provide the proper rendering and property access, we
must apply a built-in type converter to the MenuItemData class like this:
[TypeConverter(typeof(ExpandableObjectConverter))]
public class MenuItemData
{
...
The built-in ExpandableObjectConverter type converter suffices for MenuItemData, because
this class consists of simple property types. If this class had more complex properties, as was
the case with the ImageMetaData class and its ImageLocation property of type Location, we would
need to implement a custom ExpandableObjectConverter type converter. Figure 11-4 displays
the built-in collection editor in action.
CHAPTER 11 ?– DES IGN-TIME S UPPORT 549
Figure 11-4. The built-in collection editor Windows Form UI
The built-in collection editor provides the exact same functionality as our custom collection
editor from the previous edition of this book, so no further action is required. For reference
purposes, Listing 11-10 presents the code for MenuItemDataCollectionEditor.
Listing 11-10. The MenuItemDataCollectionEditor Source
using System;
using System.ComponentModel;
using System.ComponentModel.Design;
using System.Design;
using System.Windows.Forms;
using System.Windows.
Pages:
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721