ok cool, thanks il give that a go, ive also been
trying to see what it uses by looking at
the .net reflector tool.
I did try and fool it giving it the type of the inner type
(i found it picks this type by looking for the type of the
Item property wich is the this[int index}
but giving the data as a list of wrappers, but although the title was
correct,
it complained it couldnt convert the items to the wrapper type
when it tried to save it.
I tried using converter, custom descriptor, and descriptor provider,
but it never seems to hit any of the functions that can be overiden
that i could use
Colin =^.^=
"Marc Gravell" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> Well, the following shows a way to customise the title (there may be
> simpler ways, but I can't see them). Obviously you'd need to put some
> different code in around ".Text = " to put in some code (presumably using
> reflection and GetGenericTypeDefinition() etc) to put in a more useful
> name...
>
> using System;
> using System.Collections.ObjectModel;
> using System.ComponentModel;
> using System.ComponentModel.Design;
> using System.Drawing.Design;
> using System.Windows.Forms;
>
> class CollectionEditor<T> : CollectionEditor
> {
> protected override CollectionForm CreateCollectionForm()
> {
> CollectionForm form = base.CreateCollectionForm();
> form.Text = "Here be thee " + typeof(T).Name + "s";
> return form;
> }
> public CollectionEditor() : base(typeof(T)) {}
> }
>
> class Foo
> {
> [Editor(typeof(CollectionEditor<Bar>), typeof(UITypeEditor))]
> public Collection<Bar> Bars { get; private set; }
>
> public Foo() {Bars = new Collection<Bar>();}
> }
> class Bar
> {
> public string Name { get; set; }
> public int Age { get; set; }
> }
> static class Program
> {
> [STAThread]
> static void Main()
> {
> Application.EnableVisualStyles();
> Application.Run(new Form
> {
> Controls = {
> new PropertyGrid {
> Dock = DockStyle.Fill,
> SelectedObject = new Foo()
> }
> }
> });
> }
> }