</Window>
using System;
using System.Collections.Generic;using System.Linq;using System.Text;using System.Threading.Tasks;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 Wpf180706{ /// <summary> /// Interaction logic for Window9.xaml /// </summary> public partial class Window9 : Window { public Window9() { InitializeComponent(); listBox.ItemsSource = lst; } public List<MyClass> lst = new List<MyClass>() { new MyClass(){ Price=120, Year=1990}, new MyClass(){ Price=50, Year=1950}, new MyClass(){ Price=220, Year=1998}, new MyClass(){ Price=150, Year=1992}, new MyClass(){ Price=100, Year=1991}, new MyClass(){ Price=190, Year=1999} }; } public class MyClass { public int Price { get; set; } public int Year { get; set; } }}