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

[Solved] Telerik RadGrid Editing Demo

2 Answers 170 Views
Grid for XAML
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Brock
Top achievements
Rank 1
Brock asked on 15 Jun 2013, 07:11 PM
Hello,

I am brand new to Windows 8 development. I've used your Telerik controls for asp.net applications previously, but now I'm trying them out to build an app for a Surface tablet.

I've been looking at the code from the RadGrid demo found here: http://apps.microsoft.com/windows/en-us/app/telerik-controls-examples-xaml/7cdb9bc0-e3a7-47b5-b6d6-658d88d4125d

Specifically the 'editing' example.

I'm trying to build the project from scratch using the provided code, but I'm stuck on a few errors. I'm not sure if you guys already have a completed project that I could just download or not. If not, can you help me figure out these errors?

The first is with the XmlDataParser a few lines from the bottom of Grid.Editing.Data.EditingViewModel.cs. It's giving me the error: "The name 'XmlDataParser' does not exist in the current context"

using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Globalization;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Xml.Linq;
using Telerik.Core;
 
namespace Grid.Editing.Data
{
    public class EditingViewModel : ViewModelBase
    {
        public EditingViewModel()
        {
            this.Data = this.LoadData();
        }
 
        private ObservableCollection<TaskData> LoadData()
        {
            var data = new ObservableCollection<TaskData>();
            var path = "Grid.Editing.Data.Data.xml";
 
            Action<XElement, TaskData> childElementAction = (el, a) =>
            {
                string value = el.Value;
 
                switch (el.Name.LocalName)
                {
                    case "Id":
                        a.Id = int.Parse(value, CultureInfo.InvariantCulture);
                        break;
                    case "Task":
                        a.TaskName = value;
                        break;
                    case "Effort":
                        a.Effort = int.Parse(value, CultureInfo.InvariantCulture);
                        break;
                    case "Role":
                        a.Role = value;
                        break;
                    case "StartDate":
                        if (!string.IsNullOrEmpty(value))
                        {
                            a.StartDate = DateTime.Parse(value, CultureInfo.InvariantCulture);
                        }
                        break;
                    case "EndDate":
                        if (!string.IsNullOrEmpty(value))
                        {
                            a.EndDate = DateTime.Parse(value, CultureInfo.InvariantCulture);
                        }
                        break;
                    case "Cost":
                        a.Cost = int.Parse(value, CultureInfo.InvariantCulture);
                        break;
                    case "Group":
                        a.Group = int.Parse(value, CultureInfo.InvariantCulture);
                        break;
                }
            };
 
            Action<TaskData> elementAction = (q) =>
            {
                data.Add(q);
            };
 
            XmlDataParser.Parse<TaskData>(path, elementAction, childElementAction);
 
            return data;
        }
 
        public ObservableCollection<TaskData> Data { get; set; }
    }
}


The second is with the line this.InitializeComponent();

It's giving me the error: "'Grid.Editing.Example' does not contain a definition for 'InitializeComponent' and no extension method 'InitializeComponent' accepting a first argument of type 'Grid.Editing.Example' could be found (are you missing a using directive or an assembly reference?)" in Grid.Editing.Example.xaml.cs"

using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using Grid.Editing.Data;
using Windows.Foundation;
using Windows.Foundation.Collections;
using Windows.UI.Xaml;
using Windows.UI.Xaml.Controls;
using Windows.UI.Xaml.Controls.Primitives;
using Windows.UI.Xaml.Data;
using Windows.UI.Xaml.Input;
using Windows.UI.Xaml.Media;
using Windows.UI.Xaml.Navigation;
 
// The User Control item template is documented at http://go.microsoft.com/fwlink/?LinkId=234236
 
namespace Grid.Editing
{
    public sealed partial class Example : UserControl
    {
        public Example()
        {
            this.InitializeComponent();
 
            this.DataContext = new EditingViewModel();
        }
    }
}

Thank you for any help you can provide.

2 Answers, 1 is accepted

Sort by
0
Ivaylo Gergov
Telerik team
answered on 17 Jun 2013, 01:45 PM
Hi Brock,

Thank you for contacting us.

The XmlDataParser is a helper class that we have implemented, so probably it has not been added to your project. You can install Telerik's RadControls for Windows 8 package and after that you can find the complete project of the Controls Examples in the \Program Files (x86)\Telerik\RadControls for Windows 8 XAML Q2 2013\Demos folder on your machine.

Let me know if I can assist you any further.

Regards,
Ivaylo Gergov
Telerik
Have a suggestion or face a problem - you can use the Ideas & Feedback portal to submit ideas, feedback and vote for them.
0
Brock
Top achievements
Rank 1
answered on 18 Jun 2013, 02:15 AM
Fantastic! Thank you.

I managed to get my grid up and running!

Also, this resource was very helpful: http://www.telerik.com/help/windows-8-xaml/datagrid-propertiesandconfigurations.html
Tags
Grid for XAML
Asked by
Brock
Top achievements
Rank 1
Answers by
Ivaylo Gergov
Telerik team
Brock
Top achievements
Rank 1
Share this question
or