Here's s simple one I use -- this works OK, the dialog tha tthis code is
showing is just a simple 2 column datagrid view with key value pairs -- it
seems similar to what you are trying to do.
class CostEditor : UITypeEditor
{
private IWindowsFormsEd itorService editorService = null;
public override UITypeEditorEdi tStyle
GetEditStyle(Sy stem.ComponentM odel.ITypeDescr iptorContext context)
{
return UITypeEditorEdi tStyle.Modal;
}
public override object EditValue(
ITypeDescriptor Context context,
IServiceProvide r provider,
object value)
{
if (provider != null)
{
editorService =
provider.GetSer vice(
typeof(IWindows FormsEditorServ ice))
as IWindowsFormsEd itorService;
}
if (editorService != null)
{
Prices frm = new Prices((Diction ary<string, decimal>)value) ;
frm.ShowDialog( );
if (frm.DialogResu lt == DialogResult.OK ) return value;
}
return null;
}
Then where you define the Property you need the following
[Description("Th is indicate whether this is a menu that is
called on start of a POS device."),
Category("Price s"),
Editor(typeof(C ostEditor), typeof(UITypeEd itor))]
/// <Summary>
/// Returns the prices for all plans that apply to this item
/// </Summary>
public Dictionary<stri ng, decimal> Prices
{
get { return _Prices; }
}
This way still presents the button to display the editor, but it displays my
grid not the default collection editor. My DataGridView is disabled for
editing, but if you allow editing and define the set in the property, and
also define the attribute [ReadOnly(False)] this will allow you to edit
you're values in you;re own dialog.
Hope this helps
Jamie
"Brko" <Br**@discussio ns.microsoft.co m> wrote in message
news:B6******** *************** ***********@mic rosoft.com...
Hi. Thanks. I found this solution too. But when I created my own UIEditor
it
didn't work for the property of the List<MyClass> type. May be List<>
generic
defines its own CollectionEdito r. I tryied to create my own editor for
other
types and it worked. Does anybody know how to change UIEditor for the
List<>
generic?
Thanks once more time.
B.