using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;

namespace WpfApplication2
{
    /// <summary>
    /// Interaction logic for Window1.xaml
    /// </summary>
    public partial class Window1 : Window
    {
        public Window1()
        {
            InitializeComponent();

            NorthwindDataContext context = new NorthwindDataContext();

            var query = (from o in context.Orders
                        from od in context.Order_Details
                        select new MyObject
                        {
                            OrderID = od.OrderID,
                            ProductID = od.ProductID,
                            UnitPrice = od.UnitPrice,
                            Quantity = od.Quantity,
                            Discount = od.Discount,
                            CustomerID = o.CustomerID,
                            EmployeeID = o.EmployeeID,
                            OrderDate = o.OrderDate
                        }).Take(100);

            radGridView1.ItemsSource = query;
            radGridView1.ColumnsWidthMode = Telerik.Windows.Controls.ColumnsWidthMode.Fill; 
        }

        private void radGridView1_SelectionChanged(object sender, Telerik.Windows.Controls.SelectionChangeEventArgs e)
        {
            Telerik.Windows.Data.DataRecord dr3 = (Telerik.Windows.Data.DataRecord) radGridView1.CurrentRecord;
            MyObject myObject = (MyObject) dr3.Data;  

        }
    }

    public class MyObject
    {
        public int OrderID { get; set; }
        public int ProductID { get; set; }
        public decimal UnitPrice { get; set; }
        public short Quantity { get; set; }
        public float Discount { get; set; }
        public string CustomerID { get; set; }
        public int? EmployeeID { get; set; }
        public DateTime? OrderDate { get; set; }
    }
}
