WPF C# Tutorial

        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        x:Class="AboutDialog" ListBox.SelectionChanged="ListBox_SelectionChanged"
        Button.Click="Button_Click"
        Title="About WPF Unleashed" SizeToContent="WidthAndHeight"
        Background="OrangeRed">
  
    
      WPF
    
    
    
    
      1
      2
      3
      4
      5
      6
      7
      8
      9
    

    
      Help
      OK
    

    test
  

//File:Window.xaml.cs
using System.Windows;
using System.Windows.Controls;
public partial class AboutDialog : Window
{
    public AboutDialog()
    {
        InitializeComponent();
    }
    void ListBox_SelectionChanged(object sender, SelectionChangedEventArgs e)
    {
        if (e.AddedItems.Count > 0)
            MessageBox.Show("You just selected " + e.AddedItems[0]);
    }
    void Button_Click(object sender, RoutedEventArgs e)
    {
        MessageBox.Show("You just clicked " + e.Source);
    }
}