Ok i know now hot to use simple combobox in propertygrid
(see code below)
but how to add items with value
Mother=1,Sister=2
and when user select item from combobox i get valuemember not displaymember?
Mex
public class FamilyMember : Component
{
private string relation = "Unknown";
[TypeConverter(typeof(RelationConverter)),Category( "Details")]
public string Relation
{
get { return relation; }
set { this.relation = value; }
}
}
internal class RelationConverter : StringConverter
{
private static StandardValuesCollection defaultRelations =
new StandardValuesCollection(
new string[]{"Mother", "Father", "Sister",
"Brother", "Daughter", "Son",
"Aunt", "Uncle", "Cousin"});
public override bool GetStandardValuesSupported(
ITypeDescriptorContext context)
{
return true;
}
public override bool GetStandardValuesExclusive(
ITypeDescriptorContext context)
{
// returning false here means the property will
// have a drop down and a value that can be manually
// entered.
return true;
}
public override StandardValuesCollection GetStandardValues(
ITypeDescriptorContext context)
{
return defaultRelations;
}
}
"Redivivus" <me***********@deltmar.eekirjutas sõnumis news:
Oc**************@TK2MSFTNGP02.phx.gbl...
Hi
Ho to use dropdown in propertygrid with values from database?
Lets say i have table ITEMS
and columns ID, NAME
Now i want to select id, name from items
and display those values in dropdown of my propertygrid
Best regards;
Mex