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 malli2 { /// /// Interaction logic for MainWindow.xaml /// public partial class MainWindow : Window { public MainWindow() { InitializeComponent(); } private System.Data.Objects.ObjectQuery GetReseptiQuery(luento20malliEntities luento20malliEntities) { // Auto generated code System.Data.Objects.ObjectQuery reseptiQuery = luento20malliEntities.Resepti; // To explicitly load data, you may need to add Include methods like below: // reseptiQuery = reseptiQuery.Include("Resepti.Ruokalaji"). // For more information, please see http://go.microsoft.com/fwlink/?LinkId=157380 // Update the query to include Ohje data in Resepti. You can modify this code as needed. reseptiQuery = reseptiQuery.Include("Ohje"); // Returns an ObjectQuery. return reseptiQuery; } private void Window_Loaded(object sender, RoutedEventArgs e) { malli2.luento20malliEntities luento20malliEntities = new malli2.luento20malliEntities(); // Load data into Resepti. You can modify this code as needed. System.Windows.Data.CollectionViewSource reseptiViewSource = ((System.Windows.Data.CollectionViewSource)(this.FindResource("reseptiViewSource"))); System.Data.Objects.ObjectQuery reseptiQuery = this.GetReseptiQuery(luento20malliEntities); reseptiViewSource.Source = reseptiQuery.Execute(System.Data.Objects.MergeOption.AppendOnly); } } }