Base constructor calling CreateChildElements method

3 posts, 0 answers
  1. Czeshirecat
    Czeshirecat avatar
    13 posts
    Member since:
    Jun 2016

    Posted 06 Jul Link to this post

    Hi. This is my first encounter with the Telerik control set.

    As I don't have a clue yet, I'm amending a code fragment I found online to create a custom RadTileElement for my needs.

    I'm passing in a database record to a constructor. I've then overridden the CreateChildElements method to map out the grid and set the strings etc according to whatever's passed in. But I noticed, when stepping through the code, that CreateChildElements was being called before my parameterized constructor.

    Am I correct in assuming that the base constructor is calling a virtual method?

    If the child elements are created before my constructor gets it's turn to set up the control then is there a better way to handle this?

    ty in advance



  2. Czeshirecat
    Czeshirecat avatar
    13 posts
    Member since:
    Jun 2016

    Posted 07 Jul Link to this post

    Sorry. Don't know how to delete posts.

    I just moved the code out of the virtual function and called it from the constructor.

  3. DevCraft banner
  4. Dess
    Dess avatar
    1561 posts

    Posted 07 Jul Link to this post

    Hello Claire,

    Thank you for writing. 

    It is normal that the CreateChildElements method is called before the constructor. If you are passing a data object when creating the tile, the constructor is the appropriate place to synchronize the custom elements with the associated data object.

    I hope this information helps. Should you have further questions I would be glad to help.

    Telerik by Progress
    Check out the Windows Forms project converter, which aids the conversion process from standard Windows Forms applications written in C# or VB to Telerik UI for WinForms.For more information check out this blog post and share your thoughts.
Back to Top