view SilverlightGlimpse/SilverlightGlimpse.Test/MainPage.xaml.cs @ 65:5d0c5cc83a7a

Click event handler added
author Steven Hollidge <stevenhollidge@hotmail.com>
date Sun, 22 Apr 2012 14:21:33 +0100
parents ba89e36631bc
children a0bcd783e612
line wrap: on
line source

using System;
using System.Collections.Generic;
using System.Windows;

namespace SilverlightGlimpse.Test
{
    public partial class MainPage
    {
        public MainPage()
        {
            InitializeComponent();

            // uncomment this exception to view exception on startup 
            //ThrowNestedException();

            var list = new List<object>(5)
            {
                new Person { Id = 1 , Name = "Steve"},
                new Person { Id = 2 , Name = "Dave"},
                new Person { Id = 3 , Name = "Bob"},
                new Person { Id = 4 , Name = "Rich"},
                new Person { Id = 5 , Name = "Clare"}
            };
            
            listbox1.ItemsSource = list;
        }

        private void ThrowNestedException()
        {
            throw new Exception("Oh dear we've hit an exception!",
                                new Exception("This is an inner exception"));
        }

        private void btnThrowException_Click(object sender, RoutedEventArgs e)
        {
            ThrowNestedException();
        }
    }

    public class Person
    {
        public int Id { get; set; }
        public string Name { get; set; }
    }
}