How to Reinitialize extender provider dependencies (the logic within CanExtend) from within the designer

Platform: WinForms| Category: Tips

Parse through all the Controls in the designer and call TypeDescriptor.Refresh() on them.


// From inside your custom IDesigner implementation: 
private void UpdateExtendedProperties()
{
    IDesignerHost idh = this.GetService(typeof(IDesignerHost)) as IDesignerHost;
    foreach (Component comp in idh.Container.Components)
    {
        // Ignoring the Form
        if ((comp is Control) && ((comp is Form) == false))
        {
            Control ctrl = comp as Control;
            TypeDescriptor.Refresh(ctrl);
        }
    }
}

Share with

Related FAQs

Couldn't find the FAQs you're looking for?

Please submit your question and answer.