This is a migrated thread and some comments may be shown as answers.

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

1 Answer 22 Views
DataForm
This is a migrated thread and some comments may be shown as answers.
William
Top achievements
Rank 1
William asked on 09 Feb 2017, 01:57 AM

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;

 

1 Answer, 1 is accepted

Sort by
0
Lance | Manager Technical Support
Telerik team
answered on 10 Feb 2017, 04:27 PM
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
Tags
DataForm
Asked by
William
Top achievements
Rank 1
Answers by
Lance | Manager Technical Support
Telerik team
Share this question
or