Bee Eee Blog

c# Property Grid – Getting a combo box

by brian on Oct.31, 2008, under Uncategorized

You’d think getting a combox display into the property grid would be really simple to do since it’s used everywhere in Visual Studio 2008.  And although it isn’t horrible it isn’t exactly straight forward.  I found a couple of dead-ends, poorly explained, or difficult to find the pith of examples.  Finally I ran across this one at http://gaaton.blogspot.com/ It’s nice and concise, easy to understand, and easy to adapt.  I’m going to put in my sample which essentially taken from gaaton.

internal class ProtcolConverter : StringConverter
    {
        public override bool
            GetStandardValuesSupported(
            ITypeDescriptorContext context)
        {
            //True - means show a Combobox
            //and False for show a Modal
            return true;
        }

        public override bool
            GetStandardValuesExclusive(
            ITypeDescriptorContext context)
        {
            //False - a option to edit values
            //and True - set values to state readonly
            return true;
        }

        public override StandardValuesCollection
            GetStandardValues(
            ITypeDescriptorContext context)
        {
            return new StandardValuesCollection(
                new string[] { "net.tcp", "http" });
        }
    }

And finally the we need to attach the string converter to the property by the following.

[TypeConverter(typeof(ProtcolConverter))]
public string ServiceProtocol
{
     get { return MediaServiceConfig.WCFProtocol; }
     set { MediaServiceConfig.WCFProtocol = value; }
}

Enjoy.

71 comments for this entry:
  1. ANDY


    CheapTabletsOnline.Com. Canadian Health&Care.No prescription online pharmacy.Best quality drugs.Special Internet Prices. No prescription drugs. Buy drugs online

    Buy:Levitra.Viagra Super Force.Maxaman.Cialis Super Active+.Viagra.Super Active ED Pack.VPXL.Cialis Soft Tabs.Propecia.Viagra Soft Tabs.Tramadol.Cialis.Zithromax.Cialis Professional.Viagra Professional.Soma.Viagra Super Active+….

  2. JUAN


    NEW FASHION store. Original designers collection at low prices!!! 20 % TO 70 % OFF. END OF SEASON SALE!!!

    BUY FASHION. TOP BRANDS: GUCCI, DOLCE&GABBANA, BURBERRY, DIESEL, ICEBERG, ROBERTO CAVALLI, EMPORIO ARMANI, VERSACE…

  3. Alexander7

    buy@generic.LEVITRA” rel=”nofollow”>…

    Need cheap generic LEVITRA?…

  4. SETH

    Order@Cheap.Coral.Calcium” rel=”nofollow”>..

    Buygeneric pills…

  5. BRANDON

    Order@Discount.Coral.Calcium” rel=”nofollow”>..

    Buyno prescription…

  6. LEWIS

    Purchase@Cheap.Abilify” rel=”nofollow”>..

    Buynow it…

  7. RENE

    Buy@Coral.Calcium.Online” rel=”nofollow”>.…

    Buygeneric drugs…

  8. SALVADOR

    Order@Discount.Coral.Calcium” rel=”nofollow”>..

    Buygeneric meds…

  9. PERRY

    Purchase@Cheap.Abana” rel=”nofollow”>…

    Buywithout prescription…

  10. SAMUEL

    Buy@Cheap.Acai” rel=”nofollow”>…

    Buygeneric drugs…

  11. FELIX

    Purchase@Cheap.Acai” rel=”nofollow”>…

    Buyit now…

  12. KELLY

    Cheap@Acai.Online” rel=”nofollow”>.

    Buygeneric meds…

  13. ANTONIO

    Buy@Generic.Acai” rel=”nofollow”>..

    Buynow it…

  14. MATHEW

    Order@Discount.Accutane” rel=”nofollow”>.…

    Buyno prescription…

  15. CARL

    Buy@Generic.Aciphex” rel=”nofollow”>.…

    Buygeneric meds…

  16. NATHAN

    Purchase@Generic.Aciphex.20mg” rel=”nofollow”>.…

    Buynow it…

  17. BILLY

    Buy@Generic.Actonel” rel=”nofollow”>.…

    Buygeneric drugs…

  18. RUBEN

    Buy@Generic.Actonel.Without.Prescription” rel=”nofollow”>.…

    Buygeneric meds…

  19. JONATHAN

    Purchase@Generic.Actonel” rel=”nofollow”>.

    Buygeneric meds vbg…

  20. MARCUS

    Purchase@Actonel.Without.Prescription” rel=”nofollow”>..

    Buynow it vhx…

  21. RAY

    Buy@Discount.Abana” rel=”nofollow”>.

    Buygeneric drugs zfk…

  22. LAWRENCE

    Purchase@Discount.Abilify” rel=”nofollow”>..

    Buywithout prescription dyo…

  23. SERGIO

    Order@Generic.Abilify” rel=”nofollow”>.

    Buyno prescription luw…

  24. MITCHELL

    Generic@Abilify.5mg.10mg.15mg.20mg.30mg.Without.Prescription” rel=”nofollow”>..

    Buydrugs without prescription faj…

  25. VINCENT

    Purchase@Acai.Online” rel=”nofollow”>.

    Buyit now ojb…

  26. BRYAN

    Buy@Generic.Acai.500mg” rel=”nofollow”>.

    Buygeneric drugs nih…

  27. HOMER

    Purchase@Cheap.Accupril” rel=”nofollow”>..

    Buyit now irl…

  28. PHILIP

    Purchase@Discount.Accupril” rel=”nofollow”>…

    Buygeneric meds svb…

  29. MARVIN

    Cheap@Accutane.Online” rel=”nofollow”>.

    Buynow it lmg…

  30. BRUCE

    Cheap@Generic.Aciphex.20mg” rel=”nofollow”>…

    Buynow it zdg…

  31. JOEL

    Buy@Acomplia.Online” rel=”nofollow”>..

    Buyno prescription wkp…

  32. ALEX

    Purchase@Discount.Acomplia” rel=”nofollow”>..

    Buygeneric drugs ajd…

  33. CHRIS

    Cheap@Acomplia.Online” rel=”nofollow”>..

    Buygeneric drugs nvr…

  34. STEVE

    Get@Albenza.Online” rel=”nofollow”>…

    Buynow fjl…

  35. BRENT

    abilify@and.weight.gain” rel=”nofollow”>…

    Buyno prescription…

  36. OLIVER

    phamacokinetic@of.amikacin” rel=”nofollow”>..

    Buygeneric drugs…

  37. MARTIN

    ampicillin@500.mg” rel=”nofollow”>.

    Buydrugs without prescription…

  38. LUIS

    cancer tattoos

    Buy_without prescription…

  39. JESSIE

    boniva price

    Buy_drugs without prescription…

  40. GUY

    fungi amazing facts

    Buy_drugs without prescription…

  41. KYLE

    depression amino acids

    Buy_drugs without prescription…

  42. STANLEY

    green@mountain.coffee.cafe.club” rel=”nofollow”>…

    Buygeneric meds…

  43. TIMOTHY

    augmentin@duo.buy” rel=”nofollow”>…

    Buygeneric pills…

  44. HUGH

    avodart@and.rogane” rel=”nofollow”>.

    Buydrugs without prescription…

  45. LOUIS

    rogaine@foam.canada” rel=”nofollow”>.

    Buyno prescription…

Looking for something?

Use the form below to search the site:

Still not finding what you're looking for? Drop a comment on a post or contact us so we can take care of it!

Visit our friends!

A few highly recommended friends...