Design-time Container controls proper designer.cs code generation


hello,

currenly making custom control , wish create proper designer it.  have found out using parentcontroldesigner class allow me drop controls using toolbox , gets serialized correctly.  have working smart tag used create controls similar smart tag tabcontrol object , verbs add , remove tabs.  can creation work during life time of instance within designer, cannot of generated controls serialize designer tab pages.  have working property editor dock style , have confirmed work during design time , persist run-time.  however, other properties/methods action items not serializing work designer. 

i wondering if point out tutorial me in regard.  have downloaded source code official tabcontrol, however, designer in system.design , has not been deployed symbol servers yet. 

i have tried generate code in 2 different ways.  first doing of work in custom actionlist object have created, , second use actionlist proxy dock.  appreciated. 

thanks!

it sounds smart tag logic is adding controls via 'new' operator instead of creating controls via designer host.

 

for example, tab control designer doing like:

 

idesignerhost service = (idesignerhost)getservice(typeof(idesignerhost));
tabpage page = (tabpage) service.createcomponent(typeof(tabpage));

tabcontrol component = (tabcontrol) base.component;
component.controls.add(page);

 

in addition happening within designer transaction (i have seen many times)

 

the issue appear having properties not serialising due setting relevant property values directly instead of via the appropriate propertydescriptor. setting value via propertydescriptor provides change notification require.

 

e.g.

 

propertydescriptor descriptor = typedescriptor.getproperties(control)["propertyname"];
if (descriptor != null)
{

descriptor.setvalue(control, newpropertyvalue);

}

 

instead of:

 

control.propertyname = newpropertyvalue;

 

michael right suggest use reflector disassemble tabcontroldesigner class - suspect event handlers designer verbs best starting point.

 

hope helps...

 

alex



Archived Forums V  >  Visual C# IDE



Comments

Popular posts from this blog

Azure DocumentDB Owner resource does not exist

job syspolicy_purge_history job fail in sqlserver 2008

Trying to register with public marketplace error with 'Get-AzureStackStampInformation'