//File:Window.xaml.cs using System; using System.Collections.Generic; using System.Text; using System.Windows; using System.Windows.Controls; using System.Windows.Data; using System.Windows.Documents; using System.Windows.Input; using System.Windows.Media; using System.Windows.Media.Imaging; using System.Windows.Shapes; namespace BookApp { public partial class Window1 : System.Windows.Window { public Window1() { InitializeComponent(); Book x = new Book(); x.author = "Author"; x.title = "Title"; x.price = (decimal)9.99;
Application.Current.Properties["Book"] = x; } private void MyClickEvent(object sender, RoutedEventArgs e) { Book y = (Book)Application.Current.Properties["Book"]; MessageBox.Show(y.title, y.author, MessageBoxButton.OK,MessageBoxImage.Hand); } } public class Book { public decimal price; public string title; public string author; } }