72
|
1 using System;
|
|
2 using System.Windows.Browser;
|
69
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
3 using System.Windows.Input;
|
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
4 using SilverlightValidation.Data;
|
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
5 using SilverlightValidation.ViewModels;
|
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
6 using SilverlightValidation.Validators;
|
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
7
|
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
8 namespace SilverlightValidation.Views
|
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
9 {
|
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
10 public partial class UserListView
|
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
11 {
|
71
|
12 private readonly UserListViewModel vm;
|
69
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
13
|
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
14 public UserListView()
|
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
15 {
|
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
16 InitializeComponent();
|
71
|
17 HtmlPage.Document.SetProperty("title", "Silverlight Glimpse Demo");
|
69
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
18
|
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
19 vm = new UserListViewModel(Factory.CreateUserModels(), new UserModelValidator());
|
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
20 this.DataContext = vm;
|
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
21 }
|
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
22
|
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
23 private void DatePicker_KeyDown(object sender, KeyEventArgs e)
|
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
24 {
|
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
25 if (e.Key != Key.Tab)
|
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
26 e.Handled = true;
|
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
27 }
|
72
|
28
|
|
29 private void btnThrowException_Click(object sender, System.Windows.RoutedEventArgs e)
|
|
30 {
|
|
31 throw new Exception("Oh dear we've hit an exception!",
|
|
32 new Exception("This is an inner exception"));
|
|
33 }
|
69
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
34 }
|
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
35 }
|