c# - Looking for a way to dynamically change field names in PropertyGrid -
i've got com object attached property grid.
type typeobj = type.gettypefromprogid(progidservice); var obj = activator.createinstance(typeobj); propertygrid1.selectedobject = obj;
now need way translate object fields language using translator. trying use wrapper around object com object have no propertyinfo
, have propertydescription
i'm still looking possible variants of doing it.
what reuse dynamictypedescriptor class described in answer question here on so: propertygrid browsable not found entity framework created property, how find it?
like this:
dynamictypedescriptor dtp = new dynamictypedescriptor(typeobj); // current property definition , remove var current = dtp.properties["thepropertytochange"]; dtp.removeproperty("thepropertytochange"); // add new one, change display name dynamictypedescriptor.dynamicproperty prop = new dynamictypedescriptor.dynamicproperty(dtp, current, obj); prop.setdisplayname("mynewpropertyname"); dtp.addproperty(prop); propertygrid1.selectedobject = dtp.fromcomponent(obj);
Comments
Post a Comment