c# - Change expandable property root text on click -


i have propertygrid expandable properties. looks this:

http://i.imgur.com/2fhvv41.jpg

it displays value , measurement unit. now, if user writes in double value in root row, value property change, else stays unmodified.

i want if user clicks in root row, text ("5 eur" on picture) change show value ("5"). if user doesn't click in, text stay unmodified ("5 eur").

now expandableobjectconverter looks (only relevant part):

objectproperty oldop;  public override bool canconvertto(itypedescriptorcontext context, type destinationtype) {     if (destinationtype == typeof(objectproperty))     {         return true;     }      return base.canconvertto(context, destinationtype); }  public override object convertto(itypedescriptorcontext context, system.globalization.cultureinfo culture, object value, type destinationtype) {     objectproperty op = (objectproperty)value;     oldop = op;     return op.valueprop.tostring() + " " + op.muprop.tostring(); }  public override bool canconvertfrom(itypedescriptorcontext context, type sourcetype) {     if (sourcetype == typeof(string))         return true;      return base.canconvertfrom(context, sourcetype); }  public override object convertfrom(itypedescriptorcontext context, system.globalization.cultureinfo culture, object value) {     objectproperty op;     double newvalue;     if (double.tryparse((string)value, out newvalue))     {         op = oldop;         op.valueprop = newvalue;         return op;     }     else     {         op = oldop;         return op;     } } 


Comments

Popular posts from this blog

powershell Start-Process exit code -1073741502 when used with Credential from a windows service environment -

twig - Using Twigbridge in a Laravel 5.1 Package -

c# - LINQ join Entities from HashSet's, Join vs Dictionary vs HashSet performance -