PageRenderTime 19ms CodeModel.GetById 15ms app.highlight 2ms RepoModel.GetById 1ms app.codeStats 0ms

/Main/src/Xbap/DynamicDataDisplay.Xbap.Samples/Internals/Views/FlatDemonstrationsView.xaml.cs

#
C# | 44 lines | 37 code | 4 blank | 3 comment | 2 complexity | 4cd075291709c9bfdaa52352055bbb84 MD5 | raw file
 1using System;
 2using System.Collections.Generic;
 3using System.Linq;
 4using System.Text;
 5using System.Windows;
 6using System.Windows.Controls;
 7using System.Windows.Data;
 8using System.Windows.Documents;
 9using System.Windows.Input;
10using System.Windows.Media;
11using System.Windows.Media.Imaging;
12using System.Windows.Navigation;
13using System.Windows.Shapes;
14using Microsoft.Research.DynamicDataDisplay.Samples.Internals.Models;
15using Microsoft.Research.DynamicDataDisplay.Samples.Internals.ViewModels;
16
17namespace Microsoft.Research.DynamicDataDisplay.Samples.Internals.Views
18{
19	/// <summary>
20	/// Interaction logic for FlatDemonstrationsView.xaml
21	/// </summary>
22	public partial class FlatDemonstrationsView : ViewBase
23	{
24		public FlatDemonstrationsView()
25		{
26			InitializeComponent();
27		}
28
29		private void OnDataContextChanged(object sender, DependencyPropertyChangedEventArgs e)
30		{
31			if (e.NewValue != null)
32			{
33				SamplesCollection collection = (SamplesCollection)e.NewValue;
34
35				var query = from r in collection.Releases
36							from d in r.Demonstrations
37							select new DemonstrationViewModel { Demonstration = d, Version = r.Version };
38				FlatViewModel viewModel = new FlatViewModel(query.ToList());
39
40				itemsControl.DataContext = viewModel.Demonstrations;
41			}
42		}
43	}
44}