xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
x:Class="NavigationApplication.SelectProductPageFunction"
Title="SelectProductPageFunction"
xmlns:local="clr-namespace:NavigationApplication"
x:TypeArguments="local:Product">
A
B
C
OK
Cancel
//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.Navigation;
using System.Windows.Shapes;
namespace NavigationApplication
{
public partial class SelectProductPageFunction
{
public SelectProductPageFunction()
{
InitializeComponent();
}
private void lnkOK_Click(object sender, RoutedEventArgs e)
{
ListBoxItem item = (ListBoxItem)lstProducts.SelectedItem;
Product product = new Product(item.Content.ToString());
OnReturn(new ReturnEventArgs(product));
}
private void lnkCancel_Click(object sender, RoutedEventArgs e)
{
OnReturn(null);
}
}
public class Product
{
private string name;
public string Name
{
get { return name; }
set { name = value; }
}
public Product(string name)
{
Name = name;
}
}
}