DataForm demo code fails on this.root.Children.Add(form) line

2 posts, 0 answers
  1. William
    William avatar
    1 posts
    Member since:
    Feb 2017

    Posted 08 Feb Link to this post

    I am trying to test the DataForm control but when I tried the example code on the website  the complier says "this.root" does not exist.

    Heres my code

    public MainPage()
            {
                this.InitializeComponent();
                
                var form = new RadDataForm();
                form.Item = new JobDefn(0, 0, 0, 0, 0, 123456, new DateTime(2017, 2, 7), new DateTime(2017, 2, 8));    
                this.root.Children.Add(form);   // this .root  problem with this line
            }

    and the error

    Error    CS1061    'MainPage' does not contain a definition for 'root' and no extension method 'root' accepting a first argument of type 'MainPage' could be found (are you missing a using directive or an assembly reference?)    

    root must be related to Frame somehow but I just don't see it

    it also fails if I move it to other pages

    I have tried adding every Telerik namspace that seemed to be a possibilty

    using Telerik.Core.Data;
    using Telerik.Data;
    using Telerik.UI;
    using Telerik.UI.Xaml.Controls.Data.DataForm;

     

  2. Lance | Tech Support Engineer, Sr.
    Admin
    Lance | Tech Support Engineer, Sr. avatar
    347 posts

    Posted 10 Feb Link to this post

    Hi William,

    I am following up with you in your Support Ticket for this same problem very shortly. I'm almost done updating your demos with a thorough explanation and more demo code to help.

    In a nutshell, the reason you're seeing the error is because you don't have a UIElement with the name "root" (the default File > New > App doesn't give the Grid on MainPage an x:Name).

    This will all be clear in my ticket response. Thank you for your patience while I put together the demos and ticket response, I will get back to you as soon as I'm done.

    Regards,
    Lance | Tech Support Engineer, Sr.
    Telerik by Progress
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
Back to Top