view SilverlightGlimpse/SilverlightValidation/Views/UserView.xaml.cs @ 100:9b6855dc165e

Updated System.Windows into Libs
author stevenhollidge <stevenhollidge@hotmail.com>
date Sat, 05 May 2012 23:04:16 +0100
parents 5172a9b9800c
children
line wrap: on
line source

using System;
using System.Windows;
using System.Windows.Browser;
using System.Windows.Input;
using SilverlightValidation.Models;
using SilverlightValidation.Validators;
using SilverlightValidation.ViewModels;

namespace SilverlightValidation.Views
{
    public partial class UserView
    {
        private UserViewModel vm;

        public UserView()
        {
            InitializeComponent();
            HtmlPage.Document.SetProperty("title", "Silverlight Validation");

            vm = new UserViewModel(UserModel.Create(), new UserModelValidator());
            this.DataContext = vm;

            // uncomment this exception to view exception on startup 
            //ThrowException();
        }

        private void DatePicker_KeyDown(object sender, KeyEventArgs e)
        {
            if (e.Key != Key.Tab)
                e.Handled = true;
        }

        private void btnThrowException_OnClick(object sender, RoutedEventArgs e)
        {
            ThrowException();
        }

        private void ThrowException()
        {
            throw new Exception("Oh dear we've hit an exception!");
        }
    }
}