This is what I want to do and I am struggling with it:
I have a property which gets displayed in the property grid and when
the user clicks on it, a form shows up which allows the user to select
multiple email id's and when he clicks OK, the list should be displayed
for the property as a comma seperated string.
I am not able to even show the form currently. This is what I have:
property displayed in grid:
private EMailUserList to;
public EMailUserList To
{
get
{
return to;
}
set
{
to = value;
}
}
EMailUserList consist of:
public class EMailUsers
{
private string emailList = default(string);
public string EMails
{
get
{
SelectUsers users = new SelectUsers();
if (users.ShowDialog() == DialogResult.OK)
{
emailList = users.EMailList;
}
else
emailList = String.Empty;
return emailList;
}
set
{
emailList = value;
}
}
public override string ToString()
{
return emailList;
}
}
and SelectUsers is the form.
Also if I have a property which returns an Array/ArrayList i can see
the button with 3 dots coming up in property grid, which I don't get,
how do I achive this.
I know I am doing something very wrong and might have to write a type
converter but I am not able to even figure out what type converter to
write and where?
Thanks a bunch,
Mav.
jokiz - 01 Feb 2006 15:10 GMT
what you need is a UITypeEditor, read about them here:
http://www.awprofessional.com/articles/article.asp?p=169528&rl=1
Mav - 01 Feb 2006 18:36 GMT
Thanks a lot this was helpful jokiz. I have to implement a UITypeEditor
and a TypeConverter as well to achive what I want to do.
Also, is there a way to disable direct user input into the property
(keyboard) but only allow values to be selected thru the Editor.
jokiz - 02 Feb 2006 02:38 GMT
perhaps when you provide your own typeconverter, you can allow
conversions from your type to string (to display in property grid,
comma separated) but disable the conversion from string (input from
grid) to your type, explore on the canconvert functions...