CreateChildElements() called during construction

2 posts, 0 answers
  1. Tino
    Tino avatar
    37 posts
    Member since:
    Jul 2017

    Posted 25 Sep Link to this post

    I'm wondering why my RadDiagramShape's CreateChildElements() is called before it is constructed? This is calling a virtual method from constructor, and stops me from using a model object I pass into my constructor, in my overridden CreateChildElements().

    Here's the stack trace

    TestDiagram.exe!TestDiagram.UcDiagramDropdownDiagramShape.CreateChildElements() Line 69C# Telerik.WinControls.dll!Telerik.WinControls.RadElement.CallCreateChildElements()Unknown
    Telerik.WinControls.dll!Telerik.WinControls.RadElement.Construct()Unknown
     Telerik.WinControls.dll!Telerik.WinControls.RadElement.RadElement()Unknown
     Telerik.WinControls.RadDiagram.dll!Telerik.WinControls.UI.Diagrams.UIElement.UIElement()Unknown
     Telerik.WinControls.RadDiagram.dll!Telerik.WinControls.UI.Diagrams.FrameworkElement.FrameworkElement()Unknown
     Telerik.WinControls.RadDiagram.dll!Telerik.WinControls.UI.Diagrams.RadDiagramItem.RadDiagramItem()Unknown
     Telerik.WinControls.RadDiagram.dll!Telerik.WinControls.UI.Diagrams.RadDiagramShapeBase.RadDiagramShapeBase()Unknown
     Telerik.WinControls.RadDiagram.dll!Telerik.WinControls.UI.RadDiagramShape.RadDiagramShape()Unknown
    >TestDiagram.exe!TestDiagram.UcDiagramShape.UcDiagramShape(TestDiagram.DataModelItem item) Line 14C#
     TestDiagram.exe!TestDiagram.UcDiagramDropdownDiagramShape.UcDiagramDropdownDiagramShape(TestDiagram.DataModelItem item) Line 39C#
     TestDiagram.exe!TestDiagram.RadForm1.RadForm1() Line 16C#

     

     

  2. Dimitar
    Admin
    Dimitar avatar
    1877 posts

    Posted 26 Sep Link to this post

    Hi Tino,

    Yes, this is how the element structure is created and the method is called before the constructor. This method is used for early initialization. This does not prevent you to use your model. In your case, you can create the elements in the CreateChildElements method and then update them in the form's constructor where the model is available.

    Should you have any other questions do not hesitate to ask.

    Regards,
    Dimitar
    Progress Telerik
    Try our brand new, jQuery-free Angular 2 components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
Back to Top